解析: 题意读懂后很简单,读不懂就做不出来。读懂的秘诀:盯着图看十分钟。hartal是罢工的意思,party表示的是罢工的团体。
1 #include <stdio.h> 2 #include <string.h> 3 int main() 4 { 5 int hartal[4000]; 6 int step, days, kase, partys, i, count; 7 scanf("%d", &kase); 8 while(kase--){ 9 count = 0; 10 memset(hartal,0,sizeof(hartal)); 11 scanf("%d", &days); 12 scanf("%d", &partys); 13 while(partys--){ 14 scanf("%d", &step); 15 i = 0; 16 while(i <= days){ 17 i+= step; 18 if(i % 7 != 0 && i % 7 != 6) 19 hartal[i] = 1; 20 } 21 } 22 for(i = 0; i <= days; i++) 23 if(hartal[i]) 24 count++; 25 printf("%d\n", count); 26 } 27 return 0; 28 }