답안 #219334

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
219334 2020-04-05T07:10:52 Z ne4eHbKa Datum (COCI20_datum) C++17
50 / 50
11 ms 384 KB
#include <bits/stdc++.h>
using namespace std;

//#pragma comment(linker, "/stack:200000000")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,-O3")

#define fr(i, n) for(int i = 0; i < n; ++i)
#define fo(n) fr(i, n)

#define re return

string st(int x, int y) {re !y ? "" : st(x / 10, y - 1) + char('0' + x % 10);}

array<int, 3> f[] = {
{101, 10, 10},
{102, 10, 20},
{103, 10, 30},
{110, 10, 1},
{111, 10, 11},
{112, 10, 21},
{113, 10, 31},
{120, 10, 2},
{121, 10, 12},
{122, 10, 22},
{130, 10, 3},
{131, 10, 13},
{132, 10, 23},
{140, 10, 4},
{141, 10, 14},
{142, 10, 24},
{150, 10, 5},
{151, 10, 15},
{152, 10, 25},
{160, 10, 6},
{161, 10, 16},
{162, 10, 26},
{170, 10, 7},
{171, 10, 17},
{172, 10, 27},
{180, 10, 8},
{181, 10, 18},
{182, 10, 28},
{190, 10, 9},
{191, 10, 19},
{192, 10, 29},
{1001, 1, 10},
{1002, 1, 20},
{1003, 1, 30},
{1010, 1, 1},
{1011, 1, 11},
{1012, 1, 21},
{1013, 1, 31},
{1020, 1, 2},
{1021, 1, 12},
{1022, 1, 22},
{1030, 1, 3},
{1031, 1, 13},
{1032, 1, 23},
{1040, 1, 4},
{1041, 1, 14},
{1042, 1, 24},
{1050, 1, 5},
{1051, 1, 15},
{1052, 1, 25},
{1060, 1, 6},
{1061, 1, 16},
{1062, 1, 26},
{1070, 1, 7},
{1071, 1, 17},
{1072, 1, 27},
{1080, 1, 8},
{1081, 1, 18},
{1082, 1, 28},
{1090, 1, 9},
{1091, 1, 19},
{1092, 1, 29},
{1101, 11, 10},
{1102, 11, 20},
{1103, 11, 30},
{1110, 11, 1},
{1111, 11, 11},
{1112, 11, 21},
{1120, 11, 2},
{1121, 11, 12},
{1122, 11, 22},
{1130, 11, 3},
{1131, 11, 13},
{1132, 11, 23},
{1140, 11, 4},
{1141, 11, 14},
{1142, 11, 24},
{1150, 11, 5},
{1151, 11, 15},
{1152, 11, 25},
{1160, 11, 6},
{1161, 11, 16},
{1162, 11, 26},
{1170, 11, 7},
{1171, 11, 17},
{1172, 11, 27},
{1180, 11, 8},
{1181, 11, 18},
{1182, 11, 28},
{1190, 11, 9},
{1191, 11, 19},
{1192, 11, 29},
{2001, 2, 10},
{2002, 2, 20},
{2010, 2, 1},
{2011, 2, 11},
{2012, 2, 21},
{2020, 2, 2},
{2021, 2, 12},
{2022, 2, 22},
{2030, 2, 3},
{2031, 2, 13},
{2032, 2, 23},
{2040, 2, 4},
{2041, 2, 14},
{2042, 2, 24},
{2050, 2, 5},
{2051, 2, 15},
{2052, 2, 25},
{2060, 2, 6},
{2061, 2, 16},
{2062, 2, 26},
{2070, 2, 7},
{2071, 2, 17},
{2072, 2, 27},
{2080, 2, 8},
{2081, 2, 18},
{2082, 2, 28},
{2090, 2, 9},
{2091, 2, 19},
{2092, 2, 29},
{2101, 12, 10},
{2102, 12, 20},
{2103, 12, 30},
{2110, 12, 1},
{2111, 12, 11},
{2112, 12, 21},
{2113, 12, 31},
{2120, 12, 2},
{2121, 12, 12},
{2122, 12, 22},
{2130, 12, 3},
{2131, 12, 13},
{2132, 12, 23},
{2140, 12, 4},
{2141, 12, 14},
{2142, 12, 24},
{2150, 12, 5},
{2151, 12, 15},
{2152, 12, 25},
{2160, 12, 6},
{2161, 12, 16},
{2162, 12, 26},
{2170, 12, 7},
{2171, 12, 17},
{2172, 12, 27},
{2180, 12, 8},
{2181, 12, 18},
{2182, 12, 28},
{2190, 12, 9},
{2191, 12, 19},
{2192, 12, 29},
{3001, 3, 10},
{3002, 3, 20},
{3003, 3, 30},
{3010, 3, 1},
{3011, 3, 11},
{3012, 3, 21},
{3013, 3, 31},
{3020, 3, 2},
{3021, 3, 12},
{3022, 3, 22},
{3030, 3, 3},
{3031, 3, 13},
{3032, 3, 23},
{3040, 3, 4},
{3041, 3, 14},
{3042, 3, 24},
{3050, 3, 5},
{3051, 3, 15},
{3052, 3, 25},
{3060, 3, 6},
{3061, 3, 16},
{3062, 3, 26},
{3070, 3, 7},
{3071, 3, 17},
{3072, 3, 27},
{3080, 3, 8},
{3081, 3, 18},
{3082, 3, 28},
{3090, 3, 9},
{3091, 3, 19},
{3092, 3, 29},
{4001, 4, 10},
{4002, 4, 20},
{4003, 4, 30},
{4010, 4, 1},
{4011, 4, 11},
{4012, 4, 21},
{4020, 4, 2},
{4021, 4, 12},
{4022, 4, 22},
{4030, 4, 3},
{4031, 4, 13},
{4032, 4, 23},
{4040, 4, 4},
{4041, 4, 14},
{4042, 4, 24},
{4050, 4, 5},
{4051, 4, 15},
{4052, 4, 25},
{4060, 4, 6},
{4061, 4, 16},
{4062, 4, 26},
{4070, 4, 7},
{4071, 4, 17},
{4072, 4, 27},
{4080, 4, 8},
{4081, 4, 18},
{4082, 4, 28},
{4090, 4, 9},
{4091, 4, 19},
{4092, 4, 29},
{5001, 5, 10},
{5002, 5, 20},
{5003, 5, 30},
{5010, 5, 1},
{5011, 5, 11},
{5012, 5, 21},
{5013, 5, 31},
{5020, 5, 2},
{5021, 5, 12},
{5022, 5, 22},
{5030, 5, 3},
{5031, 5, 13},
{5032, 5, 23},
{5040, 5, 4},
{5041, 5, 14},
{5042, 5, 24},
{5050, 5, 5},
{5051, 5, 15},
{5052, 5, 25},
{5060, 5, 6},
{5061, 5, 16},
{5062, 5, 26},
{5070, 5, 7},
{5071, 5, 17},
{5072, 5, 27},
{5080, 5, 8},
{5081, 5, 18},
{5082, 5, 28},
{5090, 5, 9},
{5091, 5, 19},
{5092, 5, 29},
{6001, 6, 10},
{6002, 6, 20},
{6003, 6, 30},
{6010, 6, 1},
{6011, 6, 11},
{6012, 6, 21},
{6020, 6, 2},
{6021, 6, 12},
{6022, 6, 22},
{6030, 6, 3},
{6031, 6, 13},
{6032, 6, 23},
{6040, 6, 4},
{6041, 6, 14},
{6042, 6, 24},
{6050, 6, 5},
{6051, 6, 15},
{6052, 6, 25},
{6060, 6, 6},
{6061, 6, 16},
{6062, 6, 26},
{6070, 6, 7},
{6071, 6, 17},
{6072, 6, 27},
{6080, 6, 8},
{6081, 6, 18},
{6082, 6, 28},
{6090, 6, 9},
{6091, 6, 19},
{6092, 6, 29},
{7001, 7, 10},
{7002, 7, 20},
{7003, 7, 30},
{7010, 7, 1},
{7011, 7, 11},
{7012, 7, 21},
{7013, 7, 31},
{7020, 7, 2},
{7021, 7, 12},
{7022, 7, 22},
{7030, 7, 3},
{7031, 7, 13},
{7032, 7, 23},
{7040, 7, 4},
{7041, 7, 14},
{7042, 7, 24},
{7050, 7, 5},
{7051, 7, 15},
{7052, 7, 25},
{7060, 7, 6},
{7061, 7, 16},
{7062, 7, 26},
{7070, 7, 7},
{7071, 7, 17},
{7072, 7, 27},
{7080, 7, 8},
{7081, 7, 18},
{7082, 7, 28},
{7090, 7, 9},
{7091, 7, 19},
{7092, 7, 29},
{8001, 8, 10},
{8002, 8, 20},
{8003, 8, 30},
{8010, 8, 1},
{8011, 8, 11},
{8012, 8, 21},
{8013, 8, 31},
{8020, 8, 2},
{8021, 8, 12},
{8022, 8, 22},
{8030, 8, 3},
{8031, 8, 13},
{8032, 8, 23},
{8040, 8, 4},
{8041, 8, 14},
{8042, 8, 24},
{8050, 8, 5},
{8051, 8, 15},
{8052, 8, 25},
{8060, 8, 6},
{8061, 8, 16},
{8062, 8, 26},
{8070, 8, 7},
{8071, 8, 17},
{8072, 8, 27},
{8080, 8, 8},
{8081, 8, 18},
{8082, 8, 28},
{8090, 8, 9},
{8091, 8, 19},
{8092, 8, 29},
{9001, 9, 10},
{9002, 9, 20},
{9003, 9, 30},
{9010, 9, 1},
{9011, 9, 11},
{9012, 9, 21},
{9020, 9, 2},
{9021, 9, 12},
{9022, 9, 22},
{9030, 9, 3},
{9031, 9, 13},
{9032, 9, 23},
{9040, 9, 4},
{9041, 9, 14},
{9042, 9, 24},
{9050, 9, 5},
{9051, 9, 15},
{9052, 9, 25},
{9060, 9, 6},
{9061, 9, 16},
{9062, 9, 26},
{9070, 9, 7},
{9071, 9, 17},
{9072, 9, 27},
{9080, 9, 8},
{9081, 9, 18},
{9082, 9, 28},
{9090, 9, 9},
{9091, 9, 19},
{9092, 9, 29}
};

void solve() {
    int d, m, y;
    scanf("%d.%d.%d.", &d, &m, &y);
    array<int, 3> t{y, m, d};
    array<int, 3> v = *upper_bound(f, f + 366, t);
    cout << st(v[2], 2) + '.' + st(v[1], 2) + '.' + st(v[0], 4) + '.' << '\n';
}

int main() {
    int q;
    cin >> q;
    while(q--) solve();
}

Compilation message

datum.cpp: In function 'void solve()':
datum.cpp:386:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d.%d.%d.", &d, &m, &y);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 256 KB Output is correct
2 Correct 11 ms 384 KB Output is correct
3 Correct 4 ms 256 KB Output is correct
4 Correct 4 ms 256 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Correct 4 ms 256 KB Output is correct
7 Correct 6 ms 256 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 4 ms 256 KB Output is correct
10 Correct 11 ms 384 KB Output is correct