Submission #335230

# Submission time Handle Problem Language Result Execution time Memory
335230 2020-12-11T15:54:43 Z ronnith Datum (COCI20_datum) C++14
0 / 50
136 ms 492 KB
#include <bits/stdc++.h>

using namespace std;

// char ss[100];

bool pal(string a){
	int n = a.size();
	for(int i = 0;i < 8;i ++){
		if(a[i] != a[n - i - 1])return false;
	}
	return true;
}

int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int tt;
	cin >> tt;
	int m1[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
	int m2[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
	while(tt --){
		string s;
		cin >> s;
		int dd = (s[0] - '0') * 10 + (s[1] - '0');
		int mm = (s[3] - '0') * 10 + (s[4] - '0');
		int yy = (s[6] - '0') * 1000 + (s[7] - '0') * 100 + (s[8] - '0') * 10 + (s[9] - '0');
		for(int i = dd + 1;i <= 31;i ++){
			stringstream ss;
			ss << i / 10 << i % 10 << mm / 10 << mm % 10 << yy / 1000 << (yy % 1000) / 100 << (yy % 100) / 10 << yy % 10;
			// cerr << ss.str() << '\n';
			if(pal(ss.str())){
				// cerr << "yes";
				stringstream ans;
				ans << i / 10 << i % 10 <<'.' << mm / 10 << mm % 10 << '.' << yy / 1000 << (yy % 1000) / 100 << (yy % 100) / 10 << yy % 10;
				cout << ans.str() << '\n';
				break;
			}
		}
	}
	return 0;
}

Compilation message

datum.cpp: In function 'int main()':
datum.cpp:19:6: warning: unused variable 'm1' [-Wunused-variable]
   19 |  int m1[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
      |      ^~
datum.cpp:20:6: warning: unused variable 'm2' [-Wunused-variable]
   20 |  int m2[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
      |      ^~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 492 KB Output isn't correct
2 Incorrect 136 ms 492 KB Output isn't correct
3 Incorrect 1 ms 364 KB Output isn't correct
4 Incorrect 1 ms 364 KB Output isn't correct
5 Incorrect 1 ms 364 KB Output isn't correct
6 Incorrect 1 ms 364 KB Output isn't correct
7 Incorrect 1 ms 364 KB Output isn't correct
8 Incorrect 1 ms 364 KB Output isn't correct
9 Incorrect 1 ms 364 KB Output isn't correct
10 Incorrect 136 ms 492 KB Output isn't correct