AC代码:
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;
public class Main
{
static PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
static int N = (int)1e5 + 10;
public static void main(String[] args ) throws IOException
{
String s = rd.nextLine();
int n = Integer.parseInt(s.substring(1,2)); // 得到A后面的数字(int型)
int len = 1189;
int wid = 841;
for(int i = 1 ; i <= n ; i ++)
{
int len_after= len / 2; // 记录对折一次后矩形长的长度
len = Math.max(len_after,wid); // 新矩阵长:折一次后的长度和原来的宽取最大值
wid = Math.min(len_after,wid); // 新矩阵宽:折一次后的长度和原来的宽取最小值
}
pw.println(len);
pw.println(wid);
pw.flush();
}
}
class rd
{
static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
static StringTokenizer tokenizer = new StringTokenizer("");
static String nextLine() throws IOException { return reader.readLine(); }
static String next() throws IOException
{
while (!tokenizer.hasMoreTokens()) tokenizer = new StringTokenizer(reader.readLine());
return tokenizer.nextToken();
}
static int nextInt() throws IOException { return Integer.parseInt(next()); }
static double nextDouble() throws IOException { return Double.parseDouble(next()); }
static long nextLong() throws IOException { return Long.parseLong(next());}
static BigInteger nextBigInteger() throws IOException
{
BigInteger d = new BigInteger(rd.nextLine());
return d;
}
}
class PII
{
int x,y;
public PII(int x ,int y)
{
this.x = x;
this.y = y;
}
}