#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e3+4;
struct fecha{
int d,m,a;
};
bool operator<(fecha a,fecha b){
return (a.a != b.a ? a.a < b.a : a.m != b.m ? a.m < b.m : a.d < b.d);
}
int q;
string s;
int days[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
vector<fecha> v;
void read(int &x){ x = 0;
for (char c=getchar(); '0'<=c && c<='9'; c = getchar())
x = x*10 + (c - '0');
}
int main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
for (int d1=0; d1<=9; d1++) for (int d2=0; d2<=9; d2++)
for (int d3=0; d3<=9; d3++) for (int d4=0; d4<=9; d4++){
int d = d4*10 + d3, m = d2*10 + d1, a = d1*1000 + d2*100 + d3*10 + d4;
if (0 < m && m < 13 && 0 < d && d <= days[m] + (a%4 == 0 && m == 2))
v.push_back({d, m, a});
}
read(q);
for (fecha x; q; q--){ read(x.d), read(x.m), read(x.a); getchar();
int i = upper_bound(v.begin(), v.end(), x) - v.begin();
if (v[i].d < 10) cout << "0"; cout << v[i].d << ".";
if (v[i].m < 10) cout << "0"; cout << v[i].m << ".";
if (v[i].a < 10) cout << "000";
if (v[i].a < 100) cout << "00";
if (v[i].a < 1000) cout << "0"; cout << v[i].a << ".\n";
}
return 0;
}
Compilation message
datum.cpp: In function 'int main()':
datum.cpp:38:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
38 | if (v[i].d < 10) cout << "0"; cout << v[i].d << ".";
| ^~
datum.cpp:38:33: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
38 | if (v[i].d < 10) cout << "0"; cout << v[i].d << ".";
| ^~~~
datum.cpp:39:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
39 | if (v[i].m < 10) cout << "0"; cout << v[i].m << ".";
| ^~
datum.cpp:39:33: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
39 | if (v[i].m < 10) cout << "0"; cout << v[i].m << ".";
| ^~~~
datum.cpp:42:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
42 | if (v[i].a < 1000) cout << "0"; cout << v[i].a << ".\n";
| ^~
datum.cpp:42:35: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
42 | if (v[i].a < 1000) cout << "0"; cout << v[i].a << ".\n";
| ^~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
4 ms |
468 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
332 KB |
Output is correct |
7 |
Correct |
1 ms |
332 KB |
Output is correct |
8 |
Correct |
1 ms |
328 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
4 ms |
468 KB |
Output is correct |