public class Bd02 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int t = in.nextInt();
for (int i = 0; i < t; i++) {
long x = in.nextLong();
long tmp = x, d = 1, low = 0;
while (tmp > 0) {
low = low + (tmp % 10) * d;
if (tmp % 10 == 0) {
tmp--;
continue;
}
d *= 10;
tmp /= 10;
}
System.out.println(low);
System.out.println(getInt(low));
}
in.close();
}
public static String getInt(long x) {
String s = String.valueOf(x);
int n = s.length();
StringBuilder sb = new StringBuilder();
boolean pre = false;
for (int i = 0; i < n; i++) {
char c = s.charAt(i);
if (c > '3' || pre) {
sb.append(3);
pre = true;
} else {
sb.append(c);
}
}
return sb.toString();
}
}
第二题A了,还算顺利吧,第三题感觉就是组合问题,不同组合对应着不同数量(2^n-1)。。。只有15%
#百度##笔试题目#