UVA - 10050 Hartals
#include <cstdio> #include <cstring> int parry[110]; int nowparry[110]; int main() { int t; scanf("%d", &t); while (t--) { int n; int p; scanf("%d%d", &n, &p); for (int i = 0; i < p; i++) { scanf("%d", &parry[i]); nowparry[i] = 0; } int cnt = 0; for (int i = 1; i <= n; i++) { bool isHartal = false; for (int j = 0; j < p; j++) { nowparry[j]++; if (nowparry[j] == parry[j]) { isHartal = true; nowparry[j] = 0; } } if (i%7 == 0 || i%7 == 6) continue; if (isHartal) cnt++; } printf("%d\n", cnt); } return 0; }
posted on 2014-03-05 14:06 ShineCheng 阅读(122) 评论(0) 编辑 收藏 举报