HDACM 2103
注意:在break之前需 i++ 还有m不一定小于n 用long型值计算
import java.util.Scanner;public class Main{public static void main(String[] args) {long ans[] = new long[31];for (int i = 1; i < ans.length; i++) {ans[i] = ans[i-1]+10000*(long)Math.pow(2, i-1);}Scanner sc = new Scanner(System.in);int t = sc.nextInt();while (t-- > 0) {int m = sc.nextInt();int n = sc.nextInt();int baby[] = new int[n];for (int i = 0; i < n; i++) {baby[i] = sc.nextInt();}int i = 0;for (; i <(m<n?m:n); i++) {if (baby[i] == 0) {continue;}if (baby[i]==1) {i++;break;}}System.out.println(ans[n-i]+" RMB");}sc.close();}
}