hdu 4541 Ten Googol
http://acm.hdu.edu.cn/showproblem.php?pid=4541
打表找规律
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 #include <cstdio> 2 #include <cstring> 3 #include <algorithm> 4 using namespace std; 5 6 int t; 7 int n,m; 8 int a[25][25]={{4, 1, 2, 6, 10},{4, 0, 4, 5, 9},{6, 3, 7, 8, 40, 50, 60},{6, 11, 12, 20, 30, 80, 90},{3, 15, 16, 70}, {13,13, 14 ,18, 19 ,41 ,42 ,46 ,51 ,52 ,56 ,61 ,62 ,66}, {26,17 ,21 ,22 ,26 ,31 ,32 ,36 ,44 ,45 ,49 ,54 ,55 ,59 ,64 ,65 ,69 ,81 ,82 ,86 ,91 ,92 ,96, 101}}; 9 10 11 int main() 12 { 13 scanf("%d",&t); 14 int cas=1; 15 while(t--) 16 { 17 scanf("%d%d",&n,&m); 18 printf("Case #%d: ",cas++); 19 if(m>a[n-3][0]) 20 { 21 printf("-1\n"); 22 } 23 else if(n==9&&m==23) 24 { 25 printf("10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n"); 26 } 27 else if(n==9&&m==24) 28 { 29 printf("20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n"); 30 } 31 else if(n==9&&m==25) 32 { 33 printf("60000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n"); 34 } 35 else if(n==9&&m==26) 36 { 37 printf("100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n"); 38 } 39 else 40 { 41 printf("%d\n",a[n-3][m]); 42 } 43 } 44 return 0; 45 }