Q1:纸张尺寸
题目:
思路:
A1,就是A0沿着长边对折得到的,那么A1的长就是A0的宽,A1的宽就是A0长的一半
代码:
import java.util.Scanner;
public class Question1 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String str= sc.next();
int n =str.charAt(1) - '0'; //获取他是A几
int length = 1189;
int width = 841;
for (int i = 0; i < n; i++) {
int temp = width;
width = length / 2;
length =temp;
}
System.out.println(length);
System.out.println(width);
}
}