Fork me on GitHub

A 开场白 快速幂

 
 
import java.util.*;
 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (sc.hasNext()) {
			int n = sc.nextInt();
			while (n-- > 0) {
				String str = sc.next();
				if (str.length() % 4 != 0)
					System.out.println("No");
				else {
					long len = str.length() / 4;
					StringBuffer ans = new StringBuffer("");
					StringBuffer temp = new StringBuffer("2050");
					while (len > 0) {
						if (len % 2 == 1) {
							ans.append(temp);
						}
						temp.append(temp);
						len = len >> 1;
					}
					String str2 = ans + "";
					if (str2.equals(str))
						System.out.println("Yes");
					else
						System.out.println("No");
				}
			}
		}
	}
}
posted @ 2019-07-08 11:02  cznczai  阅读(105)  评论(0编辑  收藏  举报