3 solutions
-
0
#include<iostream> using namespace std; int days[] = {0,31,28,31,30,31,30,31,31,30,31,30,31}; int is_leap(int y){ //判断闰年 return y % 400 == 0 || y % 4 == 0 && y % 100 != 0; } int daysOfMonth(int y, int m){ if( m == 2) return is_leap(y) + 28; return days[m]; } int main(){ int y = 2000, m = 1, d = 1, w = 6; // 年,月,日,周几 int ans = 0; while(y != 2020 || m != 10 || d != 2){ if(d == 1 || w == 1) ans += 2; else ans++; d++; if(d > daysOfMonth(y, m)) d = 1, m++; if(m > 12) m = 1, y++; w++; if(w == 8) w = 1; } cout << ans << endl; return 0; }
Information
- ID
- 6481
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 7
- Tags
- # Submissions
- 59
- Accepted
- 25
- Uploaded By