Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 0 Accepted Submission(s): 0
2 6 2 2 1 1 2 1 2 2 8 2 2 1 1 2 1 2 2 2 2
Sample Output
2 2
1 #include <stdio.h> 2 #include <algorithm> 3 #include <vector> 4 5 using namespace std; 6 7 struct person 8 { 9 int num; 10 int school; 11 }pe[10001]; 12 13 int main() 14 { 15 int t; 16 scanf("%d",&t); 17 while(t--) 18 { 19 int n,m,k; 20 int sum=0; 21 vector<int> sch[1001]; 22 int t; 23 scanf("%d %d %d",&n,&m,&k); 24 for(int i=1;i<=n;i++) 25 { 26 pe[i].num=i; 27 scanf("%d",&pe[i].school); 28 sch[pe[i].school].push_back(pe[i].num); 29 } 30 for(int i=1;i<=m;i++) 31 { 32 t=sch[i].size()/k; 33 for(int j=0;j<t;j++) 34 { 35 if(sch[i][j]<=n/2) 36 sum++; 37 } 38 } 39 printf("%d\n",sum); 40 } 41 return 0; 42 }
原文:https://www.cnblogs.com/jiamian/p/10703298.html