#include <bits/stdc++.h>
#define pb push_back
#define int int64_t
using namespace std;
int mp[13] = {-1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
constexpr static int M = 100;
constexpr static int Y = 10000;
bool is_palindrome(const char* s)
{
for (int i = 0; i < 4; i++)
if (s[i] != s[7-i])
return false;
return true;
}
int32_t main()
{
vector<int> v = {1011010,1021020,1031030,1101001,1111011,1121021,1131031,1201002,1211012,1221022,1301003,1311013,1321023,1401004,1411014,1421024,1501005,1511015,1521025,1601006,1611016,1621026,1701007,1711017,1721027,1801008,1811018,1821028,1901009,1911019,1921029,10010110,10020120,10030130,10100101,10110111,10120121,10130131,10200102,10210112,10220122,10300103,10310113,10320123,10400104,10410114,10420124,10500105,10510115,10520125,10600106,10610116,10620126,10700107,10710117,10720127,10800108,10810118,10820128,10900109,10910119,10920129,11011110,11021120,11031130,11101101,11111111,11121121,11201102,11211112,11221122,11301103,11311113,11321123,11401104,11411114,11421124,11501105,11511115,11521125,11601106,11611116,11621126,11701107,11711117,11721127,11801108,11811118,11821128,11901109,11911119,11921129,20010210,20020220,20100201,20110211,20120221,20200202,20210212,20220222,20300203,20310213,20320223,20400204,20410214,20420224,20500205,20510215,20520225,20600206,20610216,20620226,20700207,20710217,20720227,20800208,20810218,20820228,20900209,20910219,20920229,21011210,21021220,21031230,21101201,21111211,21121221,21131231,21201202,21211212,21221222,21301203,21311213,21321223,21401204,21411214,21421224,21501205,21511215,21521225,21601206,21611216,21621226,21701207,21711217,21721227,21801208,21811218,21821228,21901209,21911219,21921229,30010310,30020320,30030330,30100301,30110311,30120321,30130331,30200302,30210312,30220322,30300303,30310313,30320323,30400304,30410314,30420324,30500305,30510315,30520325,30600306,30610316,30620326,30700307,30710317,30720327,30800308,30810318,30820328,30900309,30910319,30920329,40010410,40020420,40030430,40100401,40110411,40120421,40200402,40210412,40220422,40300403,40310413,40320423,40400404,40410414,40420424,40500405,40510415,40520425,40600406,40610416,40620426,40700407,40710417,40720427,40800408,40810418,40820428,40900409,40910419,40920429,50010510,50020520,50030530,50100501,50110511,50120521,50130531,50200502,50210512,50220522,50300503,50310513,50320523,50400504,50410514,50420524,50500505,50510515,50520525,50600506,50610516,50620526,50700507,50710517,50720527,50800508,50810518,50820528,50900509,50910519,50920529,60010610,60020620,60030630,60100601,60110611,60120621,60200602,60210612,60220622,60300603,60310613,60320623,60400604,60410614,60420624,60500605,60510615,60520625,60600606,60610616,60620626,60700607,60710617,60720627,60800608,60810618,60820628,60900609,60910619,60920629,70010710,70020720,70030730,70100701,70110711,70120721,70130731,70200702,70210712,70220722,70300703,70310713,70320723,70400704,70410714,70420724,70500705,70510715,70520725,70600706,70610716,70620726,70700707,70710717,70720727,70800708,70810718,70820728,70900709,70910719,70920729,80010810,80020820,80030830,80100801,80110811,80120821,80130831,80200802,80210812,80220822,80300803,80310813,80320823,80400804,80410814,80420824,80500805,80510815,80520825,80600806,80610816,80620826,80700807,80710817,80720827,80800808,80810818,80820828,80900809,80910819,80920829,90010910,90020920,90030930,90100901,90110911,90120921,90200902,90210912,90220922,90300903,90310913,90320923,90400904,90410914,90420924,90500905,90510915,90520925,90600906,90610916,90620926,90700907,90710917,90720927,90800908,90810918,90820928,90900909,90910919,90920929};
int q;
cin >> q;
while (q--)
{
string s;
cin >> s;
int d = (s[0]-'0') * 10 + (s[1]-'0'), m = (s[3]-'0') * 10 + (s[4]-'0'), y = (s[6]-'0') * 1000 + (s[7]-'0') * 100 + (s[8]-'0') * 10 + (s[9]-'0');
int res = *upper_bound(v.begin(), v.end(), y * Y + m * M + d);
printf("%02d.%02d.%04d.\n", res % M, (res % Y) / M, res / Y);
}
}
Compilation message
datum.cpp: In function 'int32_t main()':
datum.cpp:28:14: warning: format '%d' expects argument of type 'int', but argument 2 has type 'int64_t' {aka 'long int'} [-Wformat=]
28 | printf("%02d.%02d.%04d.\n", res % M, (res % Y) / M, res / Y);
| ~~~^ ~~~~~~~
| | |
| int int64_t {aka long int}
| %02ld
datum.cpp:28:19: warning: format '%d' expects argument of type 'int', but argument 3 has type 'int64_t' {aka 'long int'} [-Wformat=]
28 | printf("%02d.%02d.%04d.\n", res % M, (res % Y) / M, res / Y);
| ~~~^ ~~~~~~~~~~~~~
| | |
| int int64_t {aka long int}
| %02ld
datum.cpp:28:24: warning: format '%d' expects argument of type 'int', but argument 4 has type 'int64_t' {aka 'long int'} [-Wformat=]
28 | printf("%02d.%02d.%04d.\n", res % M, (res % Y) / M, res / Y);
| ~~~^ ~~~~~~~
| | |
| int int64_t {aka long int}
| %04ld
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
16 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
16 ms |
344 KB |
Output is correct |