Submission #845068

# Submission time Handle Problem Language Result Execution time Memory
845068 2023-09-06T11:49:21 Z vjudge1 Datum (COCI20_datum) C++17
10 / 50
3 ms 348 KB
#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) {
	if (month == 0 || day == 0 || month > 12)
		return false;	
	int mx = months[month-1];
	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))
			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
1 Incorrect 0 ms 344 KB Output isn't correct
2 Incorrect 3 ms 348 KB Output isn't correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Incorrect 0 ms 348 KB Output isn't correct
6 Incorrect 0 ms 348 KB Output isn't correct
7 Incorrect 0 ms 348 KB Output isn't correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Incorrect 3 ms 348 KB Output isn't correct