1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
| #include<bits/stdc++.h> using namespace std;
int a[101] = { 5,6,8,6,9,1,6,1,2,4,9,1,9,8,2,3,6,4,7,7,5,9,5,0,3,8,7,5,8,1,5,8,6,1,8,3,0,3,7,9,2,7,0,5,8,8,5,7,0,9,9,1,9,4,4,6,8,6,3,3,8,5,1,6,3,4,6,7,0,7,8,2,7,6,8,9,5,6,5,6,1,4,0,1,0,0,9,4,8,0,9,1,2,8,5,0,2,5,3,3 }; long long ans = 0; int b[20]; int c[20] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; void dfs(int x, int pos) { if (pos == 1 && a[x] != 2) return; if (pos == 2 && a[x] != 0) return; if (pos == 3 && a[x] != 2) return; if (pos == 4 && a[x] != 3) return; b[pos] = a[x]; if (pos != 8) { for (int i = x + 1; i < 100; i++) { dfs(i, pos + 1); } } else {
int m = b[5] * 10 + b[6]; int d = b[7] * 10 + b[8];
if (m < 1 || m > 12) return; if (d < 1 || d > c[m]) return;
cout << b[1] << b[2] << b[3] << b[4] << "-" << b[5] << b[6] << "-" << b[7] << b[8] << endl;
ans++;
} } int main() {
for (int i = 0; i < 100; i++) { dfs(i, 1); }
cout << ans << endl;
return 0; }
|