标签:hdu2065
4 1 4 20 11 3 14 24 6 0
Case 1: 2 Case 2: 72 Case 3: 32 Case 4: 0 Case 1: 56 Case 2: 72 Case 3: 56
#include <stdio.h> #include <string.h> #include <math.h> int f(int n, __int64 m, int mod) { int x = 1; for ( ; m ; m >>= 1) { if (m & 1) x = x * n % mod; n = n * n % mod; } return x; } int main() { // freopen("stdin.txt", "r", stdin); int T, cas; __int64 n, a, b; while (scanf("%d", &T), T) { for (cas = 1; cas <= T; ++cas) { scanf("%I64d", &n); a = f(2, n - 1, 100); b = a + 1; if (b == 100) b = 0; printf("Case %d: %d\n", cas, a * b % 100); } printf("\n"); } return 0; }
标签:hdu2065
原文地址:http://blog.csdn.net/chang_mu/article/details/42840795