uva10050-罢工
生活随笔
收集整理的這篇文章主要介紹了
uva10050-罢工
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
小白書數(shù)據(jù)結構基礎線性表的訓練參考
?
題目鏈接 http://acm.hust.edu.cn/vjudge/problem/19134
?
解題思路
直接模擬。遇到星期五六忽略就行。
?
代碼
#include<iostream> #include<string.h> #include<stdio.h> using namespace std; const int maxLen = 101; const int maxDay = 3651; int partyDay[maxLen]; bool Day[maxDay]; int main() {int cases;cin >> cases;while(cases--) {memset(Day, false, sizeof(Day));int day, party;int tot = 0;cin >> day >> party;for(int i=0; i< party; i++) cin >> partyDay[i];for(int i=0; i< party; i++) {int j=0; j+= partyDay[i];while(j<=day) { if((j+1)%7!=0 && j%7!=0) {Day[j] = true; j+= partyDay[i];}else j+= partyDay[i];}}for(int i=1; i<=day; i++) if(Day[i]) tot++;cout << tot << endl;}return 0; }?
轉載于:https://www.cnblogs.com/ZengWangli/p/5747810.html
與50位技術專家面對面20年技術見證,附贈技術全景圖總結
以上是生活随笔為你收集整理的uva10050-罢工的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Appcan——Box
- 下一篇: 关于hibernate中提示can no