| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 845102 | vjudge1 | Datum (COCI20_datum) | C++17 | 4 ms | 348 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
 
#define fast ios::sync_with_stdio(0);cin.tie(0);
#define s second
#define f first
typedef long long ll;
const ll MOD = 998244353;
const ll LOGN = 20;
const ll MAXN = 3e5 + 5;
vector<int> months = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
vector<int> possible;
bool check(int day, int month, bool leap) {
	if (month == 0 || day == 0 || month > 12)
		return false;
	int mx = months[month-1];
	if (leap && month == 2)
		mx++;
	if (day <= mx)
		return true;
	return false;
}
int main() {
	fast
	int N;
	cin >> N;
	for (int i = 1; i <= 9999; i++) {
		int plc0 = (i / 1000) % 10;
		int plc1 = (i / 100) % 10;
		int plc2 = (i / 10) % 10;
		int plc3 = i % 10;
		if (check(plc3 * 10 + plc2, plc1 * 10 + plc0, (i % 4) == 0))
			possible.push_back(i);
	}
	for (int i = 0; i < N; i++) {
		string s;
		cin >> s;
		int year = (s[6] - '0') * 1000 + (s[7] - '0') * 100 + (s[8] - '0') * 10 + (s[9] - '0');
		int Q = upper_bound(possible.begin(), possible.end(), year) - possible.begin();
		int need_year = possible[Q];
		string ans = "";
		ans = ans + char('0' + need_year % 10);
		need_year/=10;
		ans = ans + char('0' + need_year % 10);
		need_year/=10;
		ans = ans + '.';
		ans = ans + char('0' + need_year % 10);
		need_year/=10;
		ans = ans + char('0' + need_year % 10);
		need_year/=10;
		ans = ans + '.';
		need_year = possible[Q];
		int plc0 = need_year / 1000;
		int plc1 = (need_year / 100) % 10;
		int plc2 = (need_year / 10) % 10;
		int plc3 = need_year % 10;
		ans = ans + char('0' + plc0) + char('0' + plc1) + char('0' + plc2) + char('0' + plc3) + '.';
		cout << ans << "\n"; 	
	}
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
