QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#368213 | #3916. A Bishop's Journey | KLPP# | AC ✓ | 11ms | 9564kb | Python3 | 175b | 2024-03-26 22:04:17 | 2024-03-26 22:04:18 |
Judging History
answer
n,m=map(int,input().split(" "))
import math
g=math.gcd(n-1,m-1)
L=math.lcm(n-1,m-1)+1
A=(n-1)//g
B=(m-1)//g
cuts=((A+1)*(B+1))//2-A*B-1
L+=cuts
print(L%(pow(10,18)+9))
详细
Test #1:
score: 100
Accepted
time: 9ms
memory: 9544kb
input:
15 22
output:
42
result:
ok 1 number(s): "42"
Test #2:
score: 0
Accepted
time: 5ms
memory: 9444kb
input:
5 4
output:
10
result:
ok 1 number(s): "10"
Test #3:
score: 0
Accepted
time: 2ms
memory: 9436kb
input:
2 4
output:
4
result:
ok 1 number(s): "4"
Test #4:
score: 0
Accepted
time: 9ms
memory: 9552kb
input:
4 3
output:
6
result:
ok 1 number(s): "6"
Test #5:
score: 0
Accepted
time: 9ms
memory: 9448kb
input:
6 9
output:
27
result:
ok 1 number(s): "27"
Test #6:
score: 0
Accepted
time: 10ms
memory: 9544kb
input:
719952 868634
output:
312687392784
result:
ok 1 number(s): "312687392784"
Test #7:
score: 0
Accepted
time: 10ms
memory: 9552kb
input:
289481 581103
output:
63081745256
result:
ok 1 number(s): "63081745256"
Test #8:
score: 0
Accepted
time: 8ms
memory: 9416kb
input:
834830 721237
output:
301055142355
result:
ok 1 number(s): "301055142355"
Test #9:
score: 0
Accepted
time: 6ms
memory: 9448kb
input:
142083 732026
output:
52004225079
result:
ok 1 number(s): "52004225079"
Test #10:
score: 0
Accepted
time: 9ms
memory: 9388kb
input:
764577 965379
output:
276789751137
result:
ok 1 number(s): "276789751137"
Test #11:
score: 0
Accepted
time: 5ms
memory: 9548kb
input:
107977 631183
output:
10412250263
result:
ok 1 number(s): "10412250263"
Test #12:
score: 0
Accepted
time: 9ms
memory: 9452kb
input:
971644 348920
output:
169513012240
result:
ok 1 number(s): "169513012240"
Test #13:
score: 0
Accepted
time: 4ms
memory: 9452kb
input:
251570 13601
output:
1710801785
result:
ok 1 number(s): "1710801785"
Test #14:
score: 0
Accepted
time: 6ms
memory: 9540kb
input:
553935 194838
output:
53963793765
result:
ok 1 number(s): "53963793765"
Test #15:
score: 0
Accepted
time: 9ms
memory: 9444kb
input:
765258 548232
output:
209769461928
result:
ok 1 number(s): "209769461928"
Test #16:
score: 0
Accepted
time: 10ms
memory: 9496kb
input:
531168 494514
output:
131335006176
result:
ok 1 number(s): "131335006176"
Test #17:
score: 0
Accepted
time: 7ms
memory: 9556kb
input:
165735 605402
output:
50168150235
result:
ok 1 number(s): "50168150235"
Test #18:
score: 0
Accepted
time: 9ms
memory: 9512kb
input:
954662 656166
output:
313208372946
result:
ok 1 number(s): "313208372946"
Test #19:
score: 0
Accepted
time: 6ms
memory: 9544kb
input:
398962 17554
output:
1945336762
result:
ok 1 number(s): "1945336762"
Test #20:
score: 0
Accepted
time: 4ms
memory: 9560kb
input:
978970 885591
output:
433483510635
result:
ok 1 number(s): "433483510635"
Test #21:
score: 0
Accepted
time: 9ms
memory: 9392kb
input:
900826 2
output:
900826
result:
ok 1 number(s): "900826"
Test #22:
score: 0
Accepted
time: 5ms
memory: 9556kb
input:
812274 976493
output:
68829584666
result:
ok 1 number(s): "68829584666"
Test #23:
score: 0
Accepted
time: 6ms
memory: 9444kb
input:
23679 999261
output:
8872935090
result:
ok 1 number(s): "8872935090"
Test #24:
score: 0
Accepted
time: 9ms
memory: 9416kb
input:
975088 925001
output:
450978687544
result:
ok 1 number(s): "450978687544"
Test #25:
score: 0
Accepted
time: 6ms
memory: 9440kb
input:
103310 994063
output:
51348324265
result:
ok 1 number(s): "51348324265"
Test #26:
score: 0
Accepted
time: 10ms
memory: 9452kb
input:
991729 988811
output:
367736956515
result:
ok 1 number(s): "367736956515"
Test #27:
score: 0
Accepted
time: 6ms
memory: 9444kb
input:
160545 912490
output:
73247853525
result:
ok 1 number(s): "73247853525"
Test #28:
score: 0
Accepted
time: 5ms
memory: 9448kb
input:
999275 984486
output:
491886123825
result:
ok 1 number(s): "491886123825"
Test #29:
score: 0
Accepted
time: 9ms
memory: 9496kb
input:
160 920052
output:
73604160
result:
ok 1 number(s): "73604160"
Test #30:
score: 0
Accepted
time: 0ms
memory: 9388kb
input:
976884 377024
output:
184154356608
result:
ok 1 number(s): "184154356608"
Test #31:
score: 0
Accepted
time: 9ms
memory: 9448kb
input:
999977 177586
output:
88790957761
result:
ok 1 number(s): "88790957761"
Test #32:
score: 0
Accepted
time: 11ms
memory: 9436kb
input:
432701 995507
output:
161533649377
result:
ok 1 number(s): "161533649377"
Test #33:
score: 0
Accepted
time: 10ms
memory: 9452kb
input:
981962 58597
output:
28770013657
result:
ok 1 number(s): "28770013657"
Test #34:
score: 0
Accepted
time: 5ms
memory: 9384kb
input:
975928 995560
output:
269887247524
result:
ok 1 number(s): "269887247524"
Test #35:
score: 0
Accepted
time: 9ms
memory: 9452kb
input:
936309 50406
output:
23597795727
result:
ok 1 number(s): "23597795727"
Test #36:
score: 0
Accepted
time: 9ms
memory: 9444kb
input:
996783 974118
output:
485492131197
result:
ok 1 number(s): "485492131197"
Test #37:
score: 0
Accepted
time: 4ms
memory: 9448kb
input:
126 923149
output:
58158387
result:
ok 1 number(s): "58158387"
Test #38:
score: 0
Accepted
time: 3ms
memory: 9452kb
input:
242944687192960505 985657710243272091
output:
611814663701345808
result:
ok 1 number(s): "611814663701345808"
Test #39:
score: 0
Accepted
time: 10ms
memory: 9452kb
input:
78256540680106139 155912603224081794
output:
182895675973406965
result:
ok 1 number(s): "182895675973406965"
Test #40:
score: 0
Accepted
time: 4ms
memory: 9388kb
input:
922822002032567319 116169147064975400
output:
707171381879352779
result:
ok 1 number(s): "707171381879352779"
Test #41:
score: 0
Accepted
time: 4ms
memory: 9444kb
input:
23632825179151086 286424044340752397
output:
152934193338279681
result:
ok 1 number(s): "152934193338279681"
Test #42:
score: 0
Accepted
time: 10ms
memory: 9560kb
input:
615566882917488412 904363679253688904
output:
285977363057559722
result:
ok 1 number(s): "285977363057559722"
Test #43:
score: 0
Accepted
time: 0ms
memory: 9440kb
input:
871282571553152695 13075036357328649
output:
697615589944932569
result:
ok 1 number(s): "697615589944932569"
Test #44:
score: 0
Accepted
time: 6ms
memory: 9456kb
input:
992059121087376262 749320316442087295
output:
940958932339149991
result:
ok 1 number(s): "940958932339149991"
Test #45:
score: 0
Accepted
time: 9ms
memory: 9560kb
input:
228408037637560101 2
output:
228408037637560101
result:
ok 1 number(s): "228408037637560101"
Test #46:
score: 0
Accepted
time: 7ms
memory: 9452kb
input:
858373824917532530 303606228882463513
output:
579550386061962765
result:
ok 1 number(s): "579550386061962765"
Test #47:
score: 0
Accepted
time: 5ms
memory: 9556kb
input:
199944711647871926 835789922358655904
output:
149805316038981321
result:
ok 1 number(s): "149805316038981321"
Test #48:
score: 0
Accepted
time: 2ms
memory: 9384kb
input:
988885266034203133 726386224315176358
output:
585121869631093382
result:
ok 1 number(s): "585121869631093382"
Test #49:
score: 0
Accepted
time: 0ms
memory: 9444kb
input:
810567941098135910 966301359180359211
output:
734389913788990199
result:
ok 1 number(s): "734389913788990199"
Test #50:
score: 0
Accepted
time: 10ms
memory: 9556kb
input:
433035925258346809 992759013732660399
output:
581732334699776242
result:
ok 1 number(s): "581732334699776242"
Test #51:
score: 0
Accepted
time: 9ms
memory: 9440kb
input:
854860770609679733 102512160472476876
output:
930982377561535769
result:
ok 1 number(s): "930982377561535769"
Test #52:
score: 0
Accepted
time: 9ms
memory: 9448kb
input:
970351363833106274 470759957868331335
output:
894859500849668602
result:
ok 1 number(s): "894859500849668602"
Test #53:
score: 0
Accepted
time: 5ms
memory: 9440kb
input:
212487040610766042 75758449800207
output:
632602464460488479
result:
ok 1 number(s): "632602464460488479"
Test #54:
score: 0
Accepted
time: 6ms
memory: 9416kb
input:
857745162823923955 930690167250050250
output:
245004237255032246
result:
ok 1 number(s): "245004237255032246"
Test #55:
score: 0
Accepted
time: 5ms
memory: 9496kb
input:
946417006780791188 349449575041285045
output:
273765090924825642
result:
ok 1 number(s): "273765090924825642"
Test #56:
score: 0
Accepted
time: 8ms
memory: 9448kb
input:
464292089294415871 856165581278176228
output:
509642947946268224
result:
ok 1 number(s): "509642947946268224"
Test #57:
score: 0
Accepted
time: 10ms
memory: 9492kb
input:
772714543754703337 573455968118273747
output:
757492258876783385
result:
ok 1 number(s): "757492258876783385"
Test #58:
score: 0
Accepted
time: 0ms
memory: 9516kb
input:
894743488343525352 908344923098528511
output:
864899979706266430
result:
ok 1 number(s): "864899979706266430"
Test #59:
score: 0
Accepted
time: 0ms
memory: 9412kb
input:
999082603420497606 49203723041398780
output:
593096156226842168
result:
ok 1 number(s): "593096156226842168"
Test #60:
score: 0
Accepted
time: 4ms
memory: 9448kb
input:
998754989226234958 974188807491787553
output:
138521586010433612
result:
ok 1 number(s): "138521586010433612"
Test #61:
score: 0
Accepted
time: 9ms
memory: 9564kb
input:
993758315310313670 453744
output:
936511081480911145
result:
ok 1 number(s): "936511081480911145"
Test #62:
score: 0
Accepted
time: 5ms
memory: 9384kb
input:
429340760438279320 963317059828036615
output:
810994864363295659
result:
ok 1 number(s): "810994864363295659"
Test #63:
score: 0
Accepted
time: 6ms
memory: 9440kb
input:
387442962821539378 991694976358520109
output:
776399507324059468
result:
ok 1 number(s): "776399507324059468"
Test #64:
score: 0
Accepted
time: 9ms
memory: 9492kb
input:
955787678258110955 997277223555939619
output:
585361592614138717
result:
ok 1 number(s): "585361592614138717"
Test #65:
score: 0
Accepted
time: 10ms
memory: 9448kb
input:
67320281956113489 978196079926226592
output:
877413899150356503
result:
ok 1 number(s): "877413899150356503"
Test #66:
score: 0
Accepted
time: 7ms
memory: 9440kb
input:
973154946381963033 999179628271960941
output:
440039849370738851
result:
ok 1 number(s): "440039849370738851"
Test #67:
score: 0
Accepted
time: 11ms
memory: 9564kb
input:
110340063435282928 986124304695141785
output:
45608376766860277
result:
ok 1 number(s): "45608376766860277"
Test #68:
score: 0
Accepted
time: 4ms
memory: 9452kb
input:
965490608991576461 979920389209931742
output:
326026121270204482
result:
ok 1 number(s): "326026121270204482"
Test #69:
score: 0
Accepted
time: 10ms
memory: 9560kb
input:
5259080409241503 994936996730465984
output:
466162311085560511
result:
ok 1 number(s): "466162311085560511"
Test #70:
score: 0
Accepted
time: 9ms
memory: 9412kb
input:
2 2
output:
2
result:
ok 1 number(s): "2"
Test #71:
score: 0
Accepted
time: 0ms
memory: 9500kb
input:
1000000000000000000 1000000000000000000
output:
1000000000000000000
result:
ok 1 number(s): "1000000000000000000"
Test #72:
score: 0
Accepted
time: 5ms
memory: 9452kb
input:
999999999999999999 1000000000000000000
output:
45
result:
ok 1 number(s): "45"
Test #73:
score: 0
Accepted
time: 0ms
memory: 9436kb
input:
2 1000000000000000000
output:
1000000000000000000
result:
ok 1 number(s): "1000000000000000000"
Test #74:
score: 0
Accepted
time: 0ms
memory: 9380kb
input:
1000000000000000000 2
output:
1000000000000000000
result:
ok 1 number(s): "1000000000000000000"