結果
問題 | No.2908 Strange Online Judge (Extra) |
ユーザー | 👑 Mizar |
提出日時 | 2024-09-01 23:56:43 |
言語 | Text (cat 8.3) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 11,316 bytes |
コンパイル時間 | 203 ms |
コンパイル使用メモリ | 5,376 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-27 22:36:00 |
合計ジャッジ時間 | 5,249 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
5,248 KB |
testcase_01 | AC | 1 ms
5,376 KB |
testcase_02 | AC | 1 ms
5,376 KB |
testcase_03 | AC | 0 ms
5,376 KB |
testcase_04 | AC | 1 ms
5,376 KB |
testcase_05 | AC | 1 ms
5,376 KB |
testcase_06 | AC | 1 ms
5,376 KB |
testcase_07 | AC | 0 ms
5,376 KB |
testcase_08 | AC | 1 ms
5,376 KB |
testcase_09 | AC | 1 ms
5,376 KB |
testcase_10 | AC | 1 ms
5,376 KB |
testcase_11 | AC | 1 ms
5,376 KB |
testcase_12 | AC | 1 ms
5,376 KB |
testcase_13 | AC | 0 ms
5,376 KB |
testcase_14 | AC | 1 ms
5,376 KB |
testcase_15 | AC | 0 ms
5,376 KB |
testcase_16 | AC | 0 ms
5,376 KB |
testcase_17 | AC | 1 ms
5,376 KB |
testcase_18 | AC | 1 ms
5,376 KB |
testcase_19 | AC | 1 ms
5,376 KB |
testcase_20 | AC | 1 ms
5,376 KB |
testcase_21 | AC | 1 ms
5,376 KB |
testcase_22 | AC | 1 ms
5,376 KB |
testcase_23 | AC | 1 ms
5,376 KB |
testcase_24 | AC | 1 ms
5,376 KB |
testcase_25 | AC | 1 ms
5,376 KB |
testcase_26 | AC | 1 ms
5,376 KB |
testcase_27 | AC | 1 ms
5,376 KB |
testcase_28 | AC | 0 ms
5,376 KB |
testcase_29 | AC | 1 ms
5,376 KB |
testcase_30 | AC | 1 ms
5,376 KB |
testcase_31 | AC | 0 ms
5,376 KB |
testcase_32 | AC | 1 ms
5,376 KB |
testcase_33 | AC | 1 ms
5,376 KB |
testcase_34 | AC | 0 ms
5,376 KB |
testcase_35 | AC | 1 ms
5,376 KB |
testcase_36 | AC | 1 ms
5,376 KB |
testcase_37 | AC | 1 ms
5,376 KB |
testcase_38 | AC | 1 ms
5,376 KB |
testcase_39 | AC | 1 ms
5,376 KB |
testcase_40 | AC | 1 ms
5,376 KB |
testcase_41 | AC | 1 ms
5,376 KB |
testcase_42 | AC | 1 ms
5,376 KB |
testcase_43 | AC | 1 ms
5,376 KB |
testcase_44 | AC | 0 ms
5,376 KB |
ソースコード
if K <= 63 # 括弧[]の中は有理数を連分数展開した時の係数を示す if K <= 32 if K <= 16 if K <= 8 if K <= 4 if K == 1 # 267914296/433494437 == [0;1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2] $0 = 267914296 * N $0 = $0 / 433494437 end if K == 2 # 318281039/768398401 == [0;2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3] $0 = 318281039 * N $0 = $0 / 768398401 end if K == 3 # 239244622/790171309 == [0;3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4] $0 = 239244622 * N $0 = $0 / 790171309 end if K == 4 # 133957148/567451585 == [0;4,4,4,4,4,4,4,4,4,4,4,4,4,4] $0 = 133957148 * N $0 = $0 / 567451585 end end if K >= 5 if K == 5 # 71351280/370497401 == [0;5,5,5,5,5,5,5,5,5,5,5,5] $0 = 71351280 * N $0 = $0 / 370497401 end if K == 6 # 89419819/551029753 == [0;6,6,6,6,6,6,6,6,6,6,7] $0 = 89419819 * N $0 = $0 / 551029753 end if K == 7 # 47301793/337737401 == [0;7,7,7,7,7,7,7,7,7,7] $0 = 47301793 * N $0 = $0 / 337737401 end if K == 8 # 114344742/928834417 == [0;8,8,8,8,8,8,8,8,8,6] $0 = 114344742 * N $0 = $0 / 928834417 end end end if K >= 9 if K <= 12 if K == 9 # 98876657/900743824 == [0;9,9,9,9,9,9,9,9,9,2] $0 = 98876657 * N $0 = $0 / 900743824 end if K == 10 # 10610040/107151001 == [0;10,10,10,10,10,10,10,10] $0 = 10610040 * N $0 = $0 / 107151001 end if K == 11 # 20466831/226980634 == [0;11,11,11,11,11,11,11,11] $0 = 20466831 * N $0 = $0 / 226980634 end if K == 12 # 37342128/451196065 == [0;12,12,12,12,12,12,12,12] $0 = 37342128 * N $0 = $0 / 451196065 end end if K >= 13 if K == 13 # 64998297/849948490 == [0;13,13,13,13,13,13,13,13] $0 = 64998297 * N $0 = $0 / 849948490 end if K == 14 # 70053979/985734289 == [0;14,14,14,14,14,14,14,9] $0 = 70053979 * N $0 = $0 / 985734289 end if K == 15 # 58998425/888892276 == [0;15,15,15,15,15,15,15,5] $0 = 58998425 * N $0 = $0 / 888892276 end if K == 16 # 52384307/841410241 == [0;16,16,16,16,16,16,16,3] $0 = 52384307 * N $0 = $0 / 841410241 end end end end if K >= 17 if K <= 24 if K <= 20 if K == 17 # 50553378/862370935 == [0;17,17,17,17,17,17,17,2] $0 = 50553378 * N $0 = $0 / 862370935 end if K == 18 # 36451999/658154881 == [0;18,18,18,18,18,18,19] $0 = 36451999 * N $0 = $0 / 658154881 end if K == 19 # 50203245/956496652 == [0;19,19,19,19,19,19,20] $0 = 50203245 * N $0 = $0 / 956496652 end if K == 20 # 3232060/64802401 == [0;20,20,20,20,20,20] $0 = 3232060 * N $0 = $0 / 64802401 end end if K >= 21 if K == 21 # 4121208/86741173 == [0;21,21,21,21,21,21] $0 = 4121208 * N $0 = $0 / 86741173 end if K == 22 # 5196290/114554089 == [0;22,22,22,22,22,22] $0 = 5196290 * N $0 = $0 / 114554089 end if K == 23 # 6485080/149438269 == [0;23,23,23,23,23,23] $0 = 6485080 * N $0 = $0 / 149438269 end if K == 24 # 8017992/192765313 == [0;24,24,24,24,24,24] $0 = 8017992 * N $0 = $0 / 192765313 end end end if K >= 25 if K <= 28 if K == 25 # 9828200/246097501 == [0;25,25,25,25,25,25] $0 = 9828200 * N $0 = $0 / 246097501 end if K == 26 # 11951758/311204713 == [0;26,26,26,26,26,26] $0 = 11951758 * N $0 = $0 / 311204713 end if K == 27 # 14427720/390082069 == [0;27,27,27,27,27,27] $0 = 14427720 * N $0 = $0 / 390082069 end if K == 28 # 17298260/484968289 == [0;28,28,28,28,28,28] $0 = 17298260 * N $0 = $0 / 484968289 end end if K >= 29 if K == 29 # 20608792/598364773 == [0;29,29,29,29,29,29] $0 = 20608792 * N $0 = $0 / 598364773 end if K == 30 # 24408090/733055401 == [0;30,30,30,30,30,30] $0 = 24408090 * N $0 = $0 / 733055401 end if K == 31 # 28748408/892127053 == [0;31,31,31,31,31,31] $0 = 28748408 * N $0 = $0 / 892127053 end if K == 32 # 30530653/977934049 == [0;32,32,32,32,32,29] $0 = 30530653 * N $0 = $0 / 977934049 end end end end end if K >= 33 if K <= 48 if K <= 40 if K <= 36 if K == 33 # 29765728/983170189 == [0;33,33,33,33,33,25] $0 = 29765728 * N $0 = $0 / 983170189 end if K == 34 # 28175277/958787387 == [0;34,34,34,34,34,21] $0 = 28175277 * N $0 = $0 / 958787387 end if K == 35 # 27120363/949986941 == [0;35,35,35,35,35,18] $0 = 27120363 * N $0 = $0 / 949986941 end if K == 36 # 26982808/972130033 == [0;36,36,36,36,36,16] $0 = 26982808 * N $0 = $0 / 972130033 end end if K >= 37 if K == 37 # 26346493/975531789 == [0;37,37,37,37,37,14] $0 = 26346493 * N $0 = $0 / 975531789 end if K == 38 # 25128576/955546709 == [0;38,38,38,38,38,12] $0 = 25128576 * N $0 = $0 / 955546709 end if K == 39 # 25557452/997395517 == [0;39,39,39,39,39,11] $0 = 25557452 * N $0 = $0 / 997395517 end if K == 40 # 23147289/926469881 == [0;40,40,40,40,40,9] $0 = 23147289 * N $0 = $0 / 926469881 end end end if K >= 41 if K <= 44 if K == 41 # 22715443/931886869 == [0;41,41,41,41,41,8] $0 = 22715443 * N $0 = $0 / 931886869 end if K == 42 # 21893095/920030959 == [0;42,42,42,42,42,7] $0 = 21893095 * N $0 = $0 / 920030959 end if K == 43 # 20625687/887383949 == [0;43,43,43,43,43,6] $0 = 20625687 * N $0 = $0 / 887383949 end if K == 44 # 22608702/995296457 == [0;44,44,44,44,44,6] $0 = 22608702 * N $0 = $0 / 995296457 end end if K >= 45 if K == 45 # 20624720/928570501 == [0;45,45,45,45,45,5] $0 = 20624720 * N $0 = $0 / 928570501 end if K == 46 # 18032648/829893637 == [0;46,46,46,46,46,4] $0 = 18032648 * N $0 = $0 / 829893637 end if K == 47 # 19649153/923928069 == [0;47,47,47,47,47,4] $0 = 19649153 * N $0 = $0 / 923928069 end if K == 48 # 16056675/771054769 == [0;48,48,48,48,48,3] $0 = 16056675 * N $0 = $0 / 771054769 end end end end if K >= 49 if K <= 56 if K <= 52 if K == 49 # 17433762/854609981 == [0;49,49,49,49,49,3] $0 = 17433762 * N $0 = $0 / 854609981 end if K == 50 # 18897603/945257951 == [0;50,50,50,50,50,3] $0 = 18897603 * N $0 = $0 / 945257951 end if K == 51 # 13678763/697885021 == [0;51,51,51,51,51,2] $0 = 13678763 * N $0 = $0 / 697885021 end if K == 52 # 14780170/768852969 == [0;52,52,52,52,52,2] $0 = 14780170 * N $0 = $0 / 768852969 end end if K >= 53 if K == 53 # 15946801/845481229 == [0;53,53,53,53,53,2] $0 = 15946801 * N $0 = $0 / 845481229 end if K == 54 # 17181182/928101889 == [0;54,54,54,54,54,2] $0 = 17181182 * N $0 = $0 / 928101889 end if K == 55 # 9326186/513109741 == [0;55,55,55,55,56] $0 = 9326186 * N $0 = $0 / 513109741 end if K == 56 # 10019633/561278313 == [0;56,56,56,56,57] $0 = 10019633 * N $0 = $0 / 561278313 end end end if K >= 57 if K <= 60 if K == 57 # 10751056/612998749 == [0;57,57,57,57,58] $0 = 10751056 * N $0 = $0 / 612998749 end if K == 58 # 11521817/668463979 == [0;58,58,58,58,59] $0 = 11521817 * N $0 = $0 / 668463979 end if K == 59 # 12333302/727873797 == [0;59,59,59,59,60] $0 = 12333302 * N $0 = $0 / 727873797 end if K == 60 # 13186921/791434981 == [0;60,60,60,60,61] $0 = 13186921 * N $0 = $0 / 791434981 end end if K >= 61 if K == 61 # 14084108/859361413 == [0;61,61,61,61,62] $0 = 14084108 * N $0 = $0 / 859361413 end if K == 62 # 15026321/931874199 == [0;62,62,62,62,63] $0 = 15026321 * N $0 = $0 / 931874199 end if K == 63 # 250173/15764869 == [0;63,63,63,63] $0 = 250173 * N $0 = $0 / 15764869 end end end end end end if K >= 64 $0 = K # $0 := K; // P_2 $1 = K * K # $1 := K**2+1; // P_3 $1 = $1 + 1 if K < 1000 $2 = $1 * K # $1,$0 := ((($1*K+$0)*K+$1),($1*K+$0)) // (P_5, P_4) $0 = $2 + $0 $2 = $0 * K $1 = $1 + $2 end $0 = $0 * N # $0 := $0*N/$1; $0 = $0 / $1 end $2 = N * N $3 = K * N if M == 0 # if M == 0: $4 = $0 * $0 # $4 := K*N*$0+N+$0+$0*$0; $4 = $4 + $0 $4 = $4 + N $3 = $3 * $0 $4 = $4 + $3 $5 = N - $0 # $5 := N*N+(2*(N-$0)-1)/K; $5 = $5 * 2 $5 = $5 - 1 $5 = $5 / K $5 = $5 + $2 if $4 > $5 # if $4 > $5: $0 = $0-1 # $0 := $0 - 1; end # end end # end ifM>1 # if M > 1: $6 = $0 + 1 # $6 := $0 + 1; $1 = M - 1 # $1 := M - 1; $3 = $3 * $6 # $4 := K*N*$6+$6*$6+(2*(N-$6)+$1)*$1/K; $4 = N - $6 $4 = $4 * 2 $4 = $4 + $1 $4 = $4 * $1 $4 = $4 / K $4 = $4 + $3 $3 = $6 * $6 $4 = $4 + $3 $5 = N + $6 # $5 := N*N+$1*(N+$6); $5 = $5 * $1 $5 = $5 + $2 if $4 < $5 # if $4 < $5: $0 = $0 + 1 # $0 := $0+1; end # end end # end $0 = $0 + N # return ($0+N); return $0