import java.io.*;
import java.math.BigInteger;
import java.util.StringTokenizer;
class Scan {
BufferedReader buffer;
StringTokenizer tok;
Scan() {
buffer = new BufferedReader(new InputStreamReader(System.in));
}
boolean hasNext() {
while (tok == null || !tok.hasMoreElements()) {
try {
tok = new StringTokenizer(buffer.readLine());
} catch (Exception e) {
return false;
}
}
return true;
}
String next() {
if (hasNext())
return tok.nextToken();
return null;
}
int nextInt() {
return Integer.parseInt(next());
}
long nextLong() {
return Long.parseLong(next());
}
}
public class Main {
public static void main(String[] args) {
PrintWriter out = new PrintWriter(new BufferedWriter(
new OutputStreamWriter(System.out)));
Scan scan = new Scan();
int T,R;
T=scan.nextInt();
for(R=1;R<=T;R++)
{
String s = scan.next();
BigInteger a = new BigInteger(s,2);
s = scan.next();
BigInteger b = new BigInteger(s,2);
BigInteger c = a.gcd(b);
out.println("Case #"+R+": "+c.toString(2));
}
out.flush();
}
}
hdu 5050 java大数进制转换
最新推荐文章于 2022-02-02 15:52:27 发布