QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#671683 | #2013. 儒略日 | Automaton# | 30 | 55ms | 120908kb | C++20 | 1.6kb | 2024-10-24 14:01:48 | 2024-10-24 14:01:49 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int normal[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int spec[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
const int N = 1e7 + 9;
struct Node {
int year, month, day;
void display() {
cout << day << " " << month << " ";
if (year < 0) {
cout << -year << " BC\n";
} else {
cout << year << "\n";
}
}
} tab[N];
bool r1(int u) {
return (u > 0) ? (u % 4 == 0) : (u % 4 == -1);
}
bool r2(int u) {
if (u % 400 == 0) return 1;
if (u % 100 == 0) return 0;
return u % 4;
}
void addJulian(Node& u) {
u.day++;
int lim = r1(u.year) ? spec[u.month] : normal[u.month];
if (u.day == lim + 1) {
u.day = 1;
u.month++;
if (u.month == 13) {
if (u.year == -1) {
u.year = 1;
} else {
u.year++;
}
u.month = 1;
}
}
}
void addGreg(Node& u) {
u.day++;
int lim = r2(u.year) ? spec[u.month] : normal[u.month];
if (u.day == lim + 1) {
u.day = 1;
u.month++;
if (u.month == 13) {
u.year++;
u.month = 1;
}
}
}
void init() {
Node u = {-4713, 1, 1};
int flg = 0;
for (int i = 1; i < N; i++) {
if (u.year < 1582) addJulian(u);
if (u.year == 1582) {
if (u.month == 10 && u.day == 4) {
u.day = 14;
addGreg(u);
flg = 1;
} else {
addJulian(u);
}
}
if (flg) addGreg(u);
tab[i] = u;
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
//freopen("julian.in", "r", stdin);
init();
int T; cin >> T;
for (int i = 1; i <= T; i++) {
int u;
cin >> u;
tab[u].display();
}
return 0;
}
詳細信息
Pretests
Final Tests
Test #1:
score: 0
Wrong Answer
time: 27ms
memory: 120812kb
input:
1000 257 299 19 191 19 48 350 193 354 309 128 347 57 49 216 234 185 360 112 43 254 237 89 188 34 147 243 110 300 245 130 190 240 350 106 342 294 198 94 128 166 330 328 22 212 19 344 250 243 177 241 139 127 210 186 61 151 244 251 291 351 18 73 106 53 156 256 304 318 68 181 312 309 269 357 253 196 257...
output:
14 9 4713 BC 26 10 4713 BC 20 1 4713 BC 10 7 4713 BC 20 1 4713 BC 18 2 4713 BC 16 12 4713 BC 12 7 4713 BC 20 12 4713 BC 5 11 4713 BC 8 5 4713 BC 13 12 4713 BC 27 2 4713 BC 19 2 4713 BC 4 8 4713 BC 22 8 4713 BC 4 7 4713 BC 26 12 4713 BC 22 4 4713 BC 13 2 4713 BC 11 9 4713 BC 25 8 4713 BC 30 3 4713 BC...
result:
wrong answer 131st lines differ - expected: '1 1 4713 BC', found: '0 0 0'
Test #2:
score: 10
Accepted
time: 22ms
memory: 120756kb
input:
1000 6395 3251 8793 7077 5270 1291 27 6247 2762 1885 3093 9099 5392 8247 4847 2637 5425 2725 6470 1341 9583 2544 7631 1256 5269 1960 9335 553 1888 8566 9889 2986 4554 4446 9796 6608 6251 1662 9865 2202 2756 6514 891 1755 7657 1181 3963 4130 3900 6986 5878 3618 5074 6251 3336 4238 3620 1849 3558 4971...
output:
5 7 4696 BC 25 11 4705 BC 28 1 4689 BC 18 5 4694 BC 6 6 4699 BC 15 7 4710 BC 28 1 4713 BC 7 2 4696 BC 25 7 4706 BC 28 2 4708 BC 20 6 4705 BC 29 11 4689 BC 6 10 4699 BC 31 7 4691 BC 9 4 4700 BC 22 3 4706 BC 8 11 4699 BC 18 6 4706 BC 18 9 4696 BC 3 9 4710 BC 28 3 4687 BC 19 12 4707 BC 22 11 4693 BC 10...
result:
ok 1000 lines
Test #3:
score: 10
Accepted
time: 12ms
memory: 120908kb
input:
1000 27743 23166 87004 36061 830 54943 26997 78474 34587 92526 60959 78723 24515 67427 52309 90785 87635 7524 65271 77534 42849 47319 95652 93924 94481 21222 47423 52435 27180 64606 64921 52650 48949 53415 57647 88417 49043 72939 24728 66810 72203 55819 82016 53124 78629 39299 12136 49440 63976 5437...
output:
16 12 4638 BC 5 6 4650 BC 16 3 4475 BC 24 9 4615 BC 10 4 4711 BC 5 6 4563 BC 30 11 4640 BC 7 11 4499 BC 11 9 4619 BC 28 4 4460 BC 24 11 4547 BC 14 7 4498 BC 13 2 4646 BC 9 8 4529 BC 20 3 4570 BC 22 7 4465 BC 7 12 4474 BC 7 8 4693 BC 14 9 4535 BC 11 4 4501 BC 25 4 4596 BC 21 7 4584 BC 18 11 4452 BC 2...
result:
ok 1000 lines
Test #4:
score: 10
Accepted
time: 27ms
memory: 120816kb
input:
10000 299452 283862 233477 48022 195762 294033 82643 237130 33910 143114 129810 109179 138459 230072 287636 21837 5051 11636 28382 246448 158609 9683 86265 16051 64723 4441 152139 152618 61633 199844 185145 226504 231773 84337 117518 45755 92966 271348 101884 73015 121278 291837 41657 151437 23662 1...
output:
9 11 3894 BC 4 3 3936 BC 24 3 4074 BC 24 6 4582 BC 20 12 4178 BC 7 1 3908 BC 7 4 4487 BC 24 3 4064 BC 3 11 4621 BC 29 10 4322 BC 27 5 4358 BC 1 12 4415 BC 30 1 4334 BC 26 11 4084 BC 4 7 3926 BC 15 10 4654 BC 30 10 4700 BC 10 11 4682 BC 15 9 4636 BC 27 9 4039 BC 1 4 4279 BC 6 7 4687 BC 7 3 4477 BC 12...
result:
ok 10000 lines
Test #5:
score: 0
Wrong Answer
time: 29ms
memory: 120840kb
input:
10000 1744649 360536 384324 1822443 1997965 1802407 427330 2056152 604801 2112704 793668 578388 1655386 2051558 1197508 2358488 1182551 2381194 136013 849577 1667858 2183990 892695 1003065 1757854 1128153 2059716 528642 2356262 669644 463190 1515053 1897644 2332591 42359 350204 426097 1133457 215574...
output:
3 8 64 4 2 3726 BC 22 3 3661 BC 30 7 277 17 2 758 21 9 222 19 12 3544 BC 9 6 917 9 11 3058 BC 8 4 1072 11 12 2541 BC 17 7 3130 BC 14 3 181 BC 10 11 904 7 8 1435 BC 8 2 1745 25 8 1476 BC 8 3 1807 20 5 4341 BC 6 1 2387 BC 7 5 147 BC 10 6 1267 25 1 2269 BC 30 3 1967 BC 28 9 100 18 9 1625 BC 13 3 927 6 ...
result:
wrong answer 16th lines differ - expected: '21 3 1745', found: '8 2 1745'
Test #6:
score: 0
Wrong Answer
time: 55ms
memory: 120880kb
input:
100000 1950875 150500 718861 2414166 956849 2305579 205931 915700 2307512 1998760 937618 953209 823763 177854 7984 234733 2064957 1141241 2368883 915076 1616203 176585 2165292 1521597 1645854 642841 803087 1160000 1466677 2298153 2296446 609273 2439738 787459 1668490 1828136 725337 1916028 70052 812...
output:
16 3 629 18 1 4301 BC 19 2 2745 BC 2 5 1897 17 9 2094 BC 12 6 1600 23 10 4150 BC 19 1 2206 BC 24 9 1605 22 4 760 22 1 2146 BC 29 9 2104 BC 5 5 2458 BC 9 12 4227 BC 10 11 4692 BC 31 8 4071 BC 18 7 941 19 7 1589 BC 11 7 1773 5 5 2208 BC 3 12 289 BC 19 6 4230 BC 31 3 1216 27 11 548 BC 7 2 207 BC 2 1 29...
result:
wrong answer 4th lines differ - expected: '29 8 1897', found: '2 5 1897'
Test #7:
score: 0
Wrong Answer
time: 49ms
memory: 120884kb
input:
100000 1973649 1481694 4758778 2447407 533994 1409912 1974136 1581496 2416488 496139 3891556 4067841 2024440 2368816 578377 3778127 3158195 4163079 4019230 1149867 2751681 2630258 2241499 3782746 3202138 4661894 4864201 3714028 506929 361403 102401 1775088 1408294 2902197 2747737 2849127 2807562 315...
output:
23 7 691 28 8 657 BC 17 9 8307 21 3 1988 30 12 3252 BC 17 2 853 BC 21 11 692 25 11 384 BC 6 9 1903 10 5 3355 BC 26 8 5936 17 8 6418 13 8 830 5 5 1773 6 7 3130 BC 10 7 5626 29 7 3931 7 1 6679 21 9 6285 1 3 1565 BC 16 2 2820 23 2 2488 21 11 1424 25 2 5639 19 9 4051 27 10 8042 12 12 8595 9 4 5451 24 11...
result:
wrong answer 3rd lines differ - expected: '28 12 8316', found: '17 9 8307'
Test #8:
score: 0
Wrong Answer
time: 50ms
memory: 120820kb
input:
100000 3543827 8074270 6832682 4183997 1752513 8424605 351437 6684898 8699196 6917186 3880104 8448705 5062449 9564280 2259414 5948578 5822877 2206752 2840952 4147277 9626255 2562967 6231082 8401292 9755178 2009057 4412064 6627523 4652026 6467617 4814280 6489656 7327228 179839 8975748 6756021 3733120...
output:
5 12 4985 25 7 17372 14 12 13977 18 3 6736 13 2 86 30 5 18330 8 3 3751 BC 24 11 13573 2 3 19081 29 12 14208 4 5 5905 21 4 18396 23 12 9137 20 5 21446 9 12 1473 25 9 11560 20 1 11217 4 10 1329 16 3 3064 24 10 6635 29 10 21615 3 3 2304 15 2 12333 2 9 18266 26 4 21968 1 7 788 6 10 7359 11 1 13417 3 11 ...
result:
wrong answer 1st lines differ - expected: '26 7 4990', found: '5 12 4985'
Test #9:
score: 0
Runtime Error
input:
100000 969863255 512041578 700605139 629561710 176210458 857786204 223724105 16051729 694452902 307653258 282757293 614942851 294634803 564771723 50714034 846186580 456544296 493671055 392020928 254552455 78296891 55098482 147093119 732617546 697549814 97389537 901576955 61661837 556724721 334567477...
output:
result:
Test #10:
score: 0
Runtime Error
input:
100000 34363893340 236277310612 166702662888 268993603588 18645082198 297103581763 198899033171 11086173697 315120559948 275759021654 78354393827 237924397441 238669363893 185565970407 271541872488 45956191485 323595620132 6873148734 264282494825 158735073101 241370346760 348392536375 352566583390 9...