QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#223330#3589. Invested MoneyatoizAC ✓10ms3880kbC++14753b2023-10-22 00:01:202023-10-22 00:01:20

Judging History

This is the latest submission verdict.

  • [2023-10-22 00:01:20]
  • Judged
  • Verdict: AC
  • Time: 10ms
  • Memory: 3880kb
  • [2023-10-22 00:01:20]
  • Submitted

answer

#include <iostream>
#include <vector>
#include <algorithm>
#include <array>
#include <functional>

using namespace std;

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	string s;
	int d, n;
	cin >> s >> n;
	if (s == "Mon") d = 2;
	else if (s == "Tue") d = 3;
	else if (s == "Wed") d = 4;
	else if (s == "Thu") d = 5;
	else if (s == "Fri") d = 6;
	else if (s == "Sat") d = 0;
	else if (s == "Sun") d = 1;

	function<int(int)> go;
	go = [d, &go](int x) {
		x += 30;
		while ((((x + d) % 7) + 7) % 7 < 2) ++x;
		if ((((x + d) % 7) + 7) % 7 == 2) x = -((-x) % 91);	
		if (x >= 0) return x;
		return go(x);
	};

	int ans = 40;
	while (n--) {
		int x; cin >> x;
		ans = min(ans, go(-x));
	}
	cout << ans << endl;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3468kb

input:

Sat 5
5 4 3 1 1

output:

25

result:

ok single line: '25'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3640kb

input:

Fri 91
60 86 79 109 74 120 50 105 121 15 80 24 52 127 57 4 9 102 93 91 46 122 22 8 21 31 67 81 95 88 115 43 78 37 128 28 38 112 99 130 106 49 116 39 108 119 16 84 18 129 114 10 44 123 113 45 29 14 72 23 87 126 56 77 58 30 51 63 70 101 100 7 92 107 64 85 53 25 98 17 71 35 66 32 73 65 94 42 36 59 11

output:

0

result:

ok single line: '0'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3640kb

input:

Sat 91
33 86 37 15 50 101 52 59 10 53 124 80 23 102 39 95 106 26 60 32 16 65 81 71 122 64 123 22 29 116 46 129 79 117 113 30 74 43 75 109 108 58 121 18 8 40 73 57 31 67 115 68 128 88 36 120 89 100 94 110 44 9 99 54 11 5 66 107 47 114 24 61 127 96 85 25 103 82 17 78 130 12 45 38 72 19 93 51 131 87 92

output:

2

result:

ok single line: '2'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3680kb

input:

Sun 91
30 17 103 19 24 12 74 58 73 116 51 102 23 107 101 115 89 69 132 47 114 62 90 118 27 25 20 79 13 46 100 108 9 6 122 54 111 87 97 61 26 11 94 53 38 82 95 32 40 67 10 59 130 37 45 33 96 117 41 65 55 31 110 124 121 39 76 44 34 75 93 88 131 128 129 109 48 104 86 125 80 16 83 68 52 81 72 123 60 18 66

output:

1

result:

ok single line: '1'

Test #5:

score: 0
Accepted
time: 0ms
memory: 3576kb

input:

Tue 54
466997567 832713610 396128276 34149457 893059888 40452010 466926572 870227112 857615746 106193882 834532609 460923177 710229626 89982053 641177115 257457002 489171192 791834201 578232129 153420051 341581265 318800291 507136992 380609404 24764192 195645814 769787913 958962989 405273398 6731136...

output:

1

result:

ok single line: '1'

Test #6:

score: 0
Accepted
time: 0ms
memory: 3632kb

input:

Sat 61
188169805 565893854 353128766 203016509 486515773 840318966 476827725 436695915 860881971 462866357 278773167 696016203 5 257501226 745138332 479712416 283135925 461810193 570661466 303569787 220172503 647788263 623953496 573980597 157637596 162101873 367384923 915486072 697764546 14417040 45...

output:

2

result:

ok single line: '2'

Test #7:

score: 0
Accepted
time: 0ms
memory: 3628kb

input:

Thu 23
869790743 930644095 889701822 874506971 468677196 763966001 833880706 751624502 786609858 30670122 85909341 75813426 327789724 461402852 812525967 326267178 44211272 354054637 1 428816186 157051818 547116167 901650556

output:

4

result:

ok single line: '4'

Test #8:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

Sun 51
696915558 102127568 179643195 833827619 291476229 666262204 587203578 873447097 665278676 780805449 3 124180500 807744522 616722376 865498591 892480138 516459632 538283951 802714590 866185669 282544771 341867692 782859619 65001663 247301577 545811943 682592136 98742397 464782315 582383955 448...

output:

1

result:

ok single line: '1'

Test #9:

score: 0
Accepted
time: 0ms
memory: 3632kb

input:

Mon 12
652283938 669281394 862577912 4 591702909 405803843 57545257 773225964 54712812 481084827 34659925 534842532

output:

4

result:

ok single line: '4'

Test #10:

score: 0
Accepted
time: 0ms
memory: 3632kb

input:

Tue 39
592097104 596784571 163862781 260192038 205116832 832090678 530328169 989488605 899925608 676707407 61391532 326972588 758950231 462441707 23556156 924721784 173097806 302851564 125295556 6 86602244 882289882 553339347 549287591 648146937 307221046 706059962 679322316 816026084 378325189 3610...

output:

1

result:

ok single line: '1'

Test #11:

score: 0
Accepted
time: 0ms
memory: 3876kb

input:

Wed 31
228972730 346219084 388892351 283470755 848264017 626455635 885949945 482795160 871474451 271932311 664020153 835411355 293325251 638715210 398932147 118451648 903100001 787164513 861601593 841380134 204353340 645041866 0 103835264 44214962 600121139 207114042 239687791 36980572 329454235 270...

output:

0

result:

ok single line: '0'

Test #12:

score: 0
Accepted
time: 0ms
memory: 3636kb

input:

Sat 5
3 1 4 1 5

output:

25

result:

ok single line: '25'

Test #13:

score: 0
Accepted
time: 0ms
memory: 3876kb

input:

Thu 14
87953679 98239844 595382045 0 389797613 155193458 702285219 394234186 274076860 208527839 689480361 488636218 537547296 599174584

output:

1

result:

ok single line: '1'

Test #14:

score: 0
Accepted
time: 0ms
memory: 3644kb

input:

Fri 13
286588757 601781687 775630579 108484195 152191956 77077507 24168825 442637434 236871084 480191580 33540644 2 249824640

output:

0

result:

ok single line: '0'

Test #15:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

Sat 45
307114981 305684284 930487379 397207870 160462074 127826639 870780088 76858638 740676357 77304804 956876153 840387635 335513007 666130132 88033257 390079043 1 843530642 478328989 339256374 307162986 341951628 462194730 500250929 587481213 212164984 213923041 121655136 992898811 42428807 14837...

output:

2

result:

ok single line: '2'

Test #16:

score: 0
Accepted
time: 0ms
memory: 3572kb

input:

Sun 91
728005896 513292980 395988905 235815960 905587546 499245365 773293301 291930118 33609553 769578486 832970049 367690999 662674297 444954113 288591791 394327191 839077571 546419520 313337118 796699000 466102536 860015350 417122633 206513351 617228254 557350615 270745562 960678788 803830726 2758...

output:

1

result:

ok single line: '1'

Test #17:

score: 0
Accepted
time: 7ms
memory: 3644kb

input:

Thu 100000
866199683 298661386 121977901 831132287 799510028 936838990 429672298 978627583 448150138 331822872 431918851 432640427 814981177 391628447 750629391 418432090 906741382 856029902 867941495 5378913 966665196 542221772 880903759 267218225 368063702 497197161 655842558 856700725 926177688 5...

output:

1

result:

ok single line: '1'

Test #18:

score: 0
Accepted
time: 10ms
memory: 3876kb

input:

Wed 100000
564289865 106533141 247727508 980609243 940193365 54006689 365261254 445976061 9056791 15158989 405324967 151808053 84426425 339707236 746510259 214545023 378862888 589884183 198951207 777659709 482049504 807192603 19371016 372087241 545228150 830883576 104444719 168280505 829329703 80036...

output:

0

result:

ok single line: '0'

Test #19:

score: 0
Accepted
time: 6ms
memory: 3532kb

input:

Mon 100000
18898 37523 68347 58467 33843 105014 85662 121805 33585 5746 127638 68303 105819 91747 32161 122980 55888 126504 13685 84915 70836 80427 58733 124410 16982 55822 54653 123991 77847 7011 62723 15225 89978 13508 83062 134854 50054 16113 115321 101255 22175 11224 91691 81330 92823 135343 489...

output:

0

result:

ok single line: '0'

Test #20:

score: 0
Accepted
time: 9ms
memory: 3584kb

input:

Tue 100000
124541 31298 35301 39030 11051 137759 54544 74113 95726 28931 62048 52903 38736 134561 31014 139957 15391 130653 72867 30412 110583 90675 135959 133659 71841 34333 118207 121097 49881 48780 78083 109999 59308 121104 33746 72384 138838 43911 100759 127974 103881 134205 93374 112740 93493 6...

output:

1

result:

ok single line: '1'

Test #21:

score: 0
Accepted
time: 9ms
memory: 3880kb

input:

Wed 100000
44288 79647 17723 139691 100652 71743 94537 117040 47647 68404 42779 100583 90489 46110 136782 44009 90736 106569 133146 58564 56967 135654 134841 77632 73283 72561 19584 135990 94794 57398 48384 127965 75395 92321 44963 109430 130719 106241 98359 15975 56019 102006 100290 105757 38719 52...

output:

0

result:

ok single line: '0'

Test #22:

score: 0
Accepted
time: 6ms
memory: 3640kb

input:

Thu 100000
35330 104649 101039 15995 123083 25160 119496 86410 3853 54200 62287 34286 54826 1359 59656 109815 100600 57350 62356 85070 131875 80767 120633 98477 96316 20457 59201 91847 110188 129811 65668 37515 26708 42694 7777 81339 62695 110078 94766 18705 4833 65057 26685 20960 107073 9430 22528 ...

output:

0

result:

ok single line: '0'

Test #23:

score: 0
Accepted
time: 0ms
memory: 3632kb

input:

Thu 1
0

output:

32

result:

ok single line: '32'

Test #24:

score: 0
Accepted
time: 9ms
memory: 3808kb

input:

Fri 100000
103561 54065 19566 95581 112667 13085 125832 125889 103764 66215 36751 2221 111449 114129 13181 108150 40035 6610 75938 98484 136656 22191 81844 79221 47096 121758 98492 107856 32518 52265 101677 109881 58639 119939 52446 114955 8355 78647 127941 36313 56906 66748 19866 34876 98380 85711 ...

output:

0

result:

ok single line: '0'

Test #25:

score: 0
Accepted
time: 9ms
memory: 3656kb

input:

Sat 100000
46903 12265 56551 29870 115405 55354 93511 70428 73264 84396 19300 115127 78984 135767 107103 110968 21452 134220 83414 122392 83290 69842 57201 39538 87683 87594 96699 57878 113846 136022 115932 94299 112451 70486 89164 31791 101935 28240 82346 130223 100517 93411 139274 117644 136522 11...

output:

2

result:

ok single line: '2'

Test #26:

score: 0
Accepted
time: 9ms
memory: 3576kb

input:

Sun 100000
89450 28908 60255 33164 112593 80764 94418 40436 18086 53801 96451 44741 12903 23663 117947 34183 51103 844 40213 113859 57206 76990 26214 44853 98402 111856 122595 16636 45098 42402 34400 51078 23994 96016 107657 118485 33350 90820 107888 75596 127623 68641 66462 26436 126744 139779 2541...

output:

1

result:

ok single line: '1'

Test #27:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

Thu 1
30

output:

0

result:

ok single line: '0'

Test #28:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

Fri 1
31

output:

31

result:

ok single line: '31'

Test #29:

score: 0
Accepted
time: 0ms
memory: 3800kb

input:

Mon 91
13 59 91 38 28 108 87 68 109 118 63 60 26 96 12 18 117 33 116 56 6 3 4 35 66 62 49 83 41 39 27 122 73 119 21 40 46 75 103 74 31 88 14 95 55 69 34 48 82 76 7 61 5 10 25 115 20 125 97 0 94 24 17 42 102 47 124 11 89 52 84 53 77 101 123 80 45 126 112 67 54 90 110 19 104 81 111 32 105 70 98

output:

0

result:

ok single line: '0'

Test #30:

score: 0
Accepted
time: 0ms
memory: 3528kb

input:

Tue 91
39 77 57 81 74 42 4 54 61 18 60 71 125 96 11 25 97 56 20 49 119 68 70 7 103 14 50 43 67 83 35 19 28 84 15 63 33 90 5 104 120 95 91 116 124 112 117 118 32 106 113 109 46 55 29 21 105 111 53 75 40 27 8 69 1 78 89 85 26 34 82 41 110 127 64 123 92 22 88 48 13 12 76 6 98 102 62 99 36 47 126

output:

1

result:

ok single line: '1'

Test #31:

score: 0
Accepted
time: 0ms
memory: 3652kb

input:

Wed 91
97 128 50 104 110 124 114 14 100 26 54 34 19 72 49 64 126 103 120 90 112 83 77 48 107 29 117 36 40 61 7 20 71 5 2 57 15 69 111 65 89 16 86 41 44 92 63 62 91 35 28 96 105 43 33 42 58 21 56 119 78 125 79 55 8 84 9 127 85 70 68 13 30 98 106 27 118 113 75 51 37 23 6 93 99 121 82 76 22 47 12

output:

0

result:

ok single line: '0'

Test #32:

score: 0
Accepted
time: 0ms
memory: 3580kb

input:

Thu 91
120 97 115 51 71 101 80 57 24 85 114 121 78 23 59 91 87 107 30 64 119 34 7 48 13 122 43 28 70 128 50 20 36 35 94 112 42 76 41 62 79 56 21 126 72 100 31 129 92 8 49 127 73 105 104 98 86 111 66 15 9 14 77 27 106 52 113 10 37 65 58 55 17 22 16 83 84 90 45 108 3 63 93 38 6 44 118 99 69 29 125

output:

0

result:

ok single line: '0'