标签:
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5463
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 366 Accepted Submission(s): 193
1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 5 using namespace std; 6 7 int main() 8 { 9 int t; 10 int sum[510]; 11 scanf("%d",&t); 12 while (t--) 13 { 14 int n,Max=0,ans=0; 15 memset(sum,0,sizeof(sum)); 16 scanf("%d",&n); 17 while (n--) 18 { 19 int a,b; 20 scanf("%d%d",&a,&b); 21 sum[a]+=b;//a类有多少个 22 if (a>Max) 23 Max=a; 24 } 25 for (int i=0; i<=Max; i++) 26 { 27 if (sum[i]==0) 28 continue; 29 if (sum[i]%64==0) 30 ans+=sum[i]/64; 31 else 32 ans+=(sum[i]/64)+1; 33 } 34 int aans; 35 if (ans%36==0) 36 aans=ans/36; 37 else 38 aans=(ans/36)+1; 39 printf ("%d\n",aans); 40 } 41 return 0; 42 }
标签:
原文地址:http://www.cnblogs.com/qq-star/p/4827234.html