還好還好蛋沒有粉
/*NAME: zfb2LANG: C++TASK: friday*/#include#include #include using namespace std;int sun=0, mon=0, tue=0, wed=0, thu=0, fri=0, sat=0; bool leap(int n){ if((n%4==0&&n%100!=0)||n%400==0) return true; else return false;}voidfun(int tol) { switch(tol%7){ case 0: sun++; break; case 1: mon++; break; case 2: tue++; break; case 3: wed++; break; case 4: thu++; break; case 5: fri++; break; case 6: sat++; break; }}int main(){ freopen("friday.in", "r", stdin); freopen("friday.out", "w", stdout); int N; cin>>N; int sum=0; for(int i=1900; i<=1900+N-1; i++){ for(int j=1; j<=12; j++){ switch(j){ case 1:case 3:case 5:case 7:case 8:case 10:case 12: {fun(sum+13); sum+=31;} break; case 4:case 6:case 9:case 11: {fun(sum+13); sum+=30;} break; case 2: { if(leap(i)) {fun(sum+13); sum+=29;} else {fun(sum+13); sum+=28;} } break; } } } cout< <<" "< <<" "< <<" "< <<" "< <<" "< <<" "< < >N; return 0;}