結果

問題 No.2906 Strange Online Judge
ユーザー 👑 MizarMizar
提出日時 2024-07-06 03:40:30
言語 Text
(cat 8.3)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 10,681 bytes
コンパイル時間 61 ms
コンパイル使用メモリ 6,944 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-09 15:05:00
合計ジャッジ時間 1,914 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 0 ms
6,944 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 1 ms
6,944 KB
testcase_06 AC 1 ms
6,944 KB
testcase_07 AC 1 ms
6,940 KB
testcase_08 AC 1 ms
6,940 KB
testcase_09 AC 1 ms
6,940 KB
testcase_10 AC 0 ms
6,940 KB
testcase_11 AC 1 ms
6,944 KB
testcase_12 AC 1 ms
6,940 KB
testcase_13 AC 0 ms
6,944 KB
testcase_14 AC 1 ms
6,940 KB
testcase_15 AC 0 ms
6,940 KB
testcase_16 AC 1 ms
6,944 KB
testcase_17 AC 1 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

if K <= 63 # 括弧[]の中は有理数を連分数展開した時の係数を示す
  if K <= 32
    if K <= 16
      if K <= 8
        if K <= 4
          if K == 1  # 701408733/433494437 == [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,1,2]
            $0 = 701408733 * N
            $0 = $0 / 433494437
          end
          if K == 2  # 1086679440/768398401 == [1;2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3]
            $0 = 1086679440 * N
            $0 = $0 / 768398401
          end
          if K == 3  # 1029415931/790171309 == [1;3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4]
            $0 = 1029415931 * N
            $0 = $0 / 790171309
          end
          if K == 4  # 701408733/567451585 == [1;4,4,4,4,4,4,4,4,4,4,4,4,4,4]
            $0 = 701408733 * N
            $0 = $0 / 567451585
          end
        end
        if K >= 5
          if K == 5  # 441848681/370497401 == [1;5,5,5,5,5,5,5,5,5,5,5,5]
            $0 = 441848681 * N
            $0 = $0 / 370497401
          end
          if K == 6  # 640449572/551029753 == [1;6,6,6,6,6,6,6,6,6,6,7]
            $0 = 640449572 * N
            $0 = $0 / 551029753
          end
          if K == 7  # 385039194/337737401 == [1;7,7,7,7,7,7,7,7,7,7]
            $0 = 385039194 * N
            $0 = $0 / 337737401
          end
          if K == 8  # 1043179159/928834417 == [1;8,8,8,8,8,8,8,8,8,6]
            $0 = 1043179159 * N
            $0 = $0 / 928834417
          end
        end
      end
      if K >= 9
        if K <= 12
          if K == 9  # 999620481/900743824 == [1;9,9,9,9,9,9,9,9,9,2]
            $0 = 999620481 * N
            $0 = $0 / 900743824
          end
          if K == 10  # 117761041/107151001 == [1;10,10,10,10,10,10,10,10]
            $0 = 117761041 * N
            $0 = $0 / 107151001
          end
          if K == 11  # 247447465/226980634 == [1;11,11,11,11,11,11,11,11]
            $0 = 247447465 * N
            $0 = $0 / 226980634
          end
          if K == 12  # 488538193/451196065 == [1;12,12,12,12,12,12,12,12]
            $0 = 488538193 * N
            $0 = $0 / 451196065
          end
        end
        if K >= 13
          if K == 13  # 914946787/849948490 == [1;13,13,13,13,13,13,13,13]
            $0 = 914946787 * N
            $0 = $0 / 849948490
          end
          if K == 14  # 1055788268/985734289 == [1;14,14,14,14,14,14,14,9]
            $0 = 1055788268 * N
            $0 = $0 / 985734289
          end
          if K == 15  # 947890701/888892276 == [1;15,15,15,15,15,15,15,5]
            $0 = 947890701 * N
            $0 = $0 / 888892276
          end
          if K == 16  # 893794548/841410241 == [1;16,16,16,16,16,16,16,3]
            $0 = 893794548 * N
            $0 = $0 / 841410241
          end
        end
      end
    end
    if K >= 17
      if K <= 24
        if K <= 20
          if K == 17  # 912924313/862370935 == [1;17,17,17,17,17,17,17,2]
            $0 = 912924313 * N
            $0 = $0 / 862370935
          end
          if K == 18  # 694606880/658154881 == [1;18,18,18,18,18,18,19]
            $0 = 694606880 * N
            $0 = $0 / 658154881
          end
          if K == 19  # 1006699897/956496652 == [1;19,19,19,19,19,19,20]
            $0 = 1006699897 * N
            $0 = $0 / 956496652
          end
          if K == 20  # 68034461/64802401 == [1;20,20,20,20,20,20]
            $0 = 68034461 * N
            $0 = $0 / 64802401
          end
        end
        if K >= 21
          if K == 21  # 90862381/86741173 == [1;21,21,21,21,21,21]
            $0 = 90862381 * N
            $0 = $0 / 86741173
          end
          if K == 22  # 119750379/114554089 == [1;22,22,22,22,22,22]
            $0 = 119750379 * N
            $0 = $0 / 114554089
          end
          if K == 23  # 155923349/149438269 == [1;23,23,23,23,23,23]
            $0 = 155923349 * N
            $0 = $0 / 149438269
          end
          if K == 24  # 200783305/192765313 == [1;24,24,24,24,24,24]
            $0 = 200783305 * N
            $0 = $0 / 192765313
          end
        end
      end
      if K >= 25
        if K <= 28
          if K == 25  # 255925701/246097501 == [1;25,25,25,25,25,25]
            $0 = 255925701 * N
            $0 = $0 / 246097501
          end
          if K == 26  # 323156471/311204713 == [1;26,26,26,26,26,26]
            $0 = 323156471 * N
            $0 = $0 / 311204713
          end
          if K == 27  # 404509789/390082069 == [1;27,27,27,27,27,27]
            $0 = 404509789 * N
            $0 = $0 / 390082069
          end
          if K == 28  # 502266549/484968289 == [1;28,28,28,28,28,28]
            $0 = 502266549 * N
            $0 = $0 / 484968289
          end
        end
        if K >= 29
          if K == 29  # 618973565/598364773 == [1;29,29,29,29,29,29]
            $0 = 618973565 * N
            $0 = $0 / 598364773
          end
          if K == 30  # 757463491/733055401 == [1;30,30,30,30,30,30]
            $0 = 757463491 * N
            $0 = $0 / 733055401
          end
          if K == 31  # 920875461/892127053 == [1;31,31,31,31,31,31]
            $0 = 920875461 * N
            $0 = $0 / 892127053
          end
          if K == 32  # 1008464702/977934049 == [1;32,32,32,32,32,29]
            $0 = 1008464702 * N
            $0 = $0 / 977934049
          end
        end
      end
    end
  end
  if K >= 33
    if K <= 48
      if K <= 40
        if K <= 36
          if K == 33  # 1012935917/983170189 == [1;33,33,33,33,33,25]
            $0 = 1012935917 * N
            $0 = $0 / 983170189
          end
          if K == 34  # 986962664/958787387 == [1;34,34,34,34,34,21]
            $0 = 986962664 * N
            $0 = $0 / 958787387
          end
          if K == 35  # 977107304/949986941 == [1;35,35,35,35,35,18]
            $0 = 977107304 * N
            $0 = $0 / 949986941
          end
          if K == 36  # 999112841/972130033 == [1;36,36,36,36,36,16]
            $0 = 999112841 * N
            $0 = $0 / 972130033
          end
        end
        if K >= 37
          if K == 37  # 1001878282/975531789 == [1;37,37,37,37,37,14]
            $0 = 1001878282 * N
            $0 = $0 / 975531789
          end
          if K == 38  # 980675285/955546709 == [1;38,38,38,38,38,12]
            $0 = 980675285 * N
            $0 = $0 / 955546709
          end
          if K == 39  # 1022952969/997395517 == [1;39,39,39,39,39,11]
            $0 = 1022952969 * N
            $0 = $0 / 997395517
          end
          if K == 40  # 949617170/926469881 == [1;40,40,40,40,40,9]
            $0 = 949617170 * N
            $0 = $0 / 926469881
          end
        end
      end
      if K >= 41
        if K <= 44
          if K == 41  # 954602312/931886869 == [1;41,41,41,41,41,8]
            $0 = 954602312 * N
            $0 = $0 / 931886869
          end
          if K == 42  # 941924054/920030959 == [1;42,42,42,42,42,7]
            $0 = 941924054 * N
            $0 = $0 / 920030959
          end
          if K == 43  # 908009636/887383949 == [1;43,43,43,43,43,6]
            $0 = 908009636 * N
            $0 = $0 / 887383949
          end
          if K == 44  # 1017905159/995296457 == [1;44,44,44,44,44,6]
            $0 = 1017905159 * N
            $0 = $0 / 995296457
          end
        end
        if K >= 45
          if K == 45  # 949195221/928570501 == [1;45,45,45,45,45,5]
            $0 = 949195221 * N
            $0 = $0 / 928570501
          end
          if K == 46  # 847926285/829893637 == [1;46,46,46,46,46,4]
            $0 = 847926285 * N
            $0 = $0 / 829893637
          end
          if K == 47  # 943577222/923928069 == [1;47,47,47,47,47,4]
            $0 = 943577222 * N
            $0 = $0 / 923928069
          end
          if K == 48  # 787111444/771054769 == [1;48,48,48,48,48,3]
            $0 = 787111444 * N
            $0 = $0 / 771054769
          end
        end
      end
    end
    if K >= 49
      if K <= 56
        if K <= 52
          if K == 49  # 872043743/854609981 == [1;49,49,49,49,49,3]
            $0 = 872043743 * N
            $0 = $0 / 854609981
          end
          if K == 50  # 964155554/945257951 == [1;50,50,50,50,50,3]
            $0 = 964155554 * N
            $0 = $0 / 945257951
          end
          if K == 51  # 711563784/697885021 == [1;51,51,51,51,51,2]
            $0 = 711563784 * N
            $0 = $0 / 697885021
          end
          if K == 52  # 783633139/768852969 == [1;52,52,52,52,52,2]
            $0 = 783633139 * N
            $0 = $0 / 768852969
          end
        end
        if K >= 53
          if K == 53  # 861428030/845481229 == [1;53,53,53,53,53,2]
            $0 = 861428030 * N
            $0 = $0 / 845481229
          end
          if K == 54  # 945283071/928101889 == [1;54,54,54,54,54,2]
            $0 = 945283071 * N
            $0 = $0 / 928101889
          end
          if K == 55  # 522435927/513109741 == [1;55,55,55,55,56]
            $0 = 522435927 * N
            $0 = $0 / 513109741
          end
          if K == 56  # 571297946/561278313 == [1;56,56,56,56,57]
            $0 = 571297946 * N
            $0 = $0 / 561278313
          end
        end
      end
      if K >= 57
        if K <= 60
          if K == 57  # 623749805/612998749 == [1;57,57,57,57,58]
            $0 = 623749805 * N
            $0 = $0 / 612998749
          end
          if K == 58  # 679985796/668463979 == [1;58,58,58,58,59]
            $0 = 679985796 * N
            $0 = $0 / 668463979
          end
          if K == 59  # 740207099/727873797 == [1;59,59,59,59,60]
            $0 = 740207099 * N
            $0 = $0 / 727873797
          end
          if K == 60  # 804621902/791434981 == [1;60,60,60,60,61]
            $0 = 804621902 * N
            $0 = $0 / 791434981
          end
        end
        if K >= 61
          if K == 61  # 873445521/859361413 == [1;61,61,61,61,62]
            $0 = 873445521 * N
            $0 = $0 / 859361413
          end
          if K == 62  # 946900520/931874199 == [1;62,62,62,62,63]
            $0 = 946900520 * N
            $0 = $0 / 931874199
          end
          if K == 63  # 16015042/15764869 == [1;63,63,63,63]
            $0 = 16015042 * N
            $0 = $0 / 15764869
          end
        end
      end
    end
  end
end
if K >= 64        # if K >= 64:
  $0 = K          #   $0 := K; // P_2
  $1 = K * K      #   $1 := K**2+1; // P_3
  $1 = $1 + 1
  if K < 1000     #   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             #   end
  $0 = $0 * N     #   return ($0*N/$1+N);
  $0 = $0 / $1
  $0 = $0 + N
end               # end
return $0
0