結果

問題 No.2906 Strange Online Judge
ユーザー 👑 MizarMizar
提出日時 2024-06-26 18:11:48
言語 Text
(cat 8.3)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 10,891 bytes
コンパイル時間 26 ms
コンパイル使用メモリ 6,684 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-09 15:04:59
合計ジャッジ時間 1,877 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 0 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 0 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 1 ms
5,376 KB
testcase_14 AC 1 ms
5,376 KB
testcase_15 AC 1 ms
5,376 KB
testcase_16 AC 0 ms
5,376 KB
testcase_17 AC 0 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

if K <= 63 # 括弧[]の中は有理数を連分数展開した時の係数を示す
  if K <= 32
    if K <= 16
      if K <= 8
        if K <= 4
          if K == 1  # 1836311903/1134903170 == [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,1,1,2]
            $0 = 1836311903 * N
            $0 = $0 / 1134903170
          end
          if K == 2  # 1855077841/1311738121 == [1;2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2]
            $0 = 1855077841 * N
            $0 = $0 / 1311738121
          end
          if K == 3  # 2609758549/2003229469 == [1;3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3]
            $0 = 2609758549 * N
            $0 = $0 / 2003229469
          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  # 3395598337/2921503573 == [1;6,6,6,6,6,6,6,6,6,6,6,6]
            $0 = 3395598337 * N
            $0 = $0 / 2921503573
          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  # 1383914473/1232221121 == [1;8,8,8,8,8,8,8,8,8,8]
            $0 = 1383914473 * N
            $0 = $0 / 1232221121
          end
        end
      end
      if K >= 9
        if K <= 12
          if K == 9  # 4316254984/3889316089 == [1;9,9,9,9,9,9,9,9,9,9]
            $0 = 4316254984 * N
            $0 = $0 / 3889316089
          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  # 1637741953/1529074009 == [1;14,14,14,14,14,14,14,14]
            $0 = 1637741953 * N
            $0 = $0 / 1529074009
          end
          if K == 15  # 2818836061/2643386626 == [1;15,15,15,15,15,15,15,15]
            $0 = 2818836061 * N
            $0 = $0 / 2643386626
          end
          if K == 16  # 4688161345/4413393409 == [1;16,16,16,16,16,16,16,16]
            $0 = 4688161345 * N
            $0 = $0 / 4413393409
          end
        end
      end
    end
    if K >= 17
      if K <= 24
        if K <= 20
          if K == 17  # 7564883143/7145976130 == [1;17,17,17,17,17,17,17,17]
            $0 = 7564883143 * N
            $0 = $0 / 7145976130
          end
          if K == 18  # 11883239857/11259624025 == [1;18,18,18,18,18,18,18,18]
            $0 = 11883239857 * N
            $0 = $0 / 11259624025
          end
          if K == 19  # 18223639633/17314842634 == [1;19,19,19,19,19,19,19,19]
            $0 = 18223639633 * N
            $0 = $0 / 17314842634
          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  # 1112676449/1078990849 == [1;32,32,32,32,32,32]
            $0 = 1112676449 * N
            $0 = $0 / 1078990849
          end
        end
      end
    end
  end
  if K >= 33
    if K <= 48
      if K <= 40
        if K <= 36
          if K == 33  # 1336683349/1297404109 == [1;33,33,33,33,33,33]
            $0 = 1336683349 * N
            $0 = $0 / 1297404109
          end
          if K == 34  # 1597085775/1551493033 == [1;34,34,34,34,34,34]
            $0 = 1597085775 * N
            $0 = $0 / 1551493033
          end
          if K == 35  # 1898469581/1845776101 == [1;35,35,35,35,35,35]
            $0 = 1898469581 * N
            $0 = $0 / 1845776101
          end
          if K == 36  # 2245841101/2185188193 == [1;36,36,36,36,36,36]
            $0 = 2245841101 * N
            $0 = $0 / 2185188193
          end
        end
        if K >= 37
          if K == 37  # 2644652109/2575105429 == [1;37,37,37,37,37,37]
            $0 = 2644652109 * N
            $0 = $0 / 2575105429
          end
          if K == 38  # 3100825499/3021370729 == [1;38,38,38,38,38,38]
            $0 = 3100825499 * N
            $0 = $0 / 3021370729
          end
          if K == 39  # 3620781685/3530320093 == [1;39,39,39,39,39,39]
            $0 = 3620781685 * N
            $0 = $0 / 3530320093
          end
          if K == 40  # 4211465721/4108809601 == [1;40,40,40,40,40,40]
            $0 = 4211465721 * N
            $0 = $0 / 4108809601
          end
        end
      end
      if K >= 41
        if K <= 44
          if K == 41  # 4880375141/4764243133 == [1;41,41,41,41,41,41]
            $0 = 4880375141 * N
            $0 = $0 / 4764243133
          end
          if K == 42  # 5635588519/5504600809 == [1;42,42,42,42,42,42]
            $0 = 5635588519 * N
            $0 = $0 / 5504600809
          end
          if K == 43  # 6485794749/6338468149 == [1;43,43,43,43,43,43]
            $0 = 6485794749 * N
            $0 = $0 / 6338468149
          end
          if K == 44  # 7440323045/7275065953 == [1;44,44,44,44,44,44]
            $0 = 7440323045 * N
            $0 = $0 / 7275065953
          end
        end
        if K >= 45
          if K == 45  # 8509173661/8324280901 == [1;45,45,45,45,45,45]
            $0 = 8509173661 * N
            $0 = $0 / 8324280901
          end
          if K == 46  # 9703049331/9496696873 == [1;46,46,46,46,46,46]
            $0 = 9703049331 * N
            $0 = $0 / 9496696873
          end
          if K == 47  # 11033387429/10803626989 == [1;47,47,47,47,47,47]
            $0 = 11033387429 * N
            $0 = $0 / 10803626989
          end
          if K == 48  # 12512392849/12257146369 == [1;48,48,48,48,48,48]
            $0 = 12512392849 * N
            $0 = $0 / 12257146369
          end
        end
      end
    end
    if K >= 49
      if K <= 56
        if K <= 52
          if K == 49  # 14153071605/13870125613 == [1;49,49,49,49,49,49]
            $0 = 14153071605 * N
            $0 = $0 / 13870125613
          end
          if K == 50  # 15969265151/15656265001 == [1;50,50,50,50,50,50]
            $0 = 15969265151 * N
            $0 = $0 / 15656265001
          end
          if K == 51  # 17975685421/17630129413 == [1;51,51,51,51,51,51]
            $0 = 17975685421 * N
            $0 = $0 / 17630129413
          end
          if K == 52  # 18247518844/17903350869 == [1;52,52,52,52,52,47]
            $0 = 18247518844 * N
            $0 = $0 / 17903350869
          end
        end
        if K >= 53
          if K == 53  # 18355720859/18015918789 == [1;53,53,53,53,53,43]
            $0 = 18355720859 * N
            $0 = $0 / 18015918789
          end
          if K == 54  # 18272636410/17940518443 == [1;54,54,54,54,54,39]
            $0 = 18272636410 * N
            $0 = $0 / 17940518443
          end
          if K == 55  # 17968167121/17647411101 == [1;55,55,55,55,55,35]
            $0 = 17968167121 * N
            $0 = $0 / 17647411101
          end
          if K == 56  # 17970925649/17655744961 == [1;56,56,56,56,56,32]
            $0 = 17970925649 * N
            $0 = $0 / 17655744961
          end
        end
      end
      if K >= 57
        if K <= 60
          if K == 57  # 18400713526/18083555749 == [1;57,57,57,57,57,30]
            $0 = 18400713526 * N
            $0 = $0 / 18083555749
          end
          if K == 58  # 18060049250/17754036119 == [1;58,58,58,58,58,27]
            $0 = 18060049250 * N
            $0 = $0 / 17754036119
          end
          if K == 59  # 18209178227/17905777605 == [1;59,59,59,59,59,25]
            $0 = 18209178227 * N
            $0 = $0 / 17905777605
          end
          if K == 60  # 18216191484/17917646941 == [1;60,60,60,60,60,23]
            $0 = 18216191484 * N
            $0 = $0 / 17917646941
          end
        end
        if K >= 61
          if K == 61  # 18060673781/17769449573 == [1;61,61,61,61,61,21]
            $0 = 18060673781 * N
            $0 = $0 / 17769449573
          end
          if K == 62  # 17720636102/17439428139 == [1;62,62,62,62,62,19]
            $0 = 17720636102 * N
            $0 = $0 / 17439428139
          end
          if K == 63  # 18181647244/17897629429 == [1;63,63,63,63,63,18]
            $0 = 18181647244 * N
            $0 = $0 / 17897629429
          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     # return ($0*N/$1+N);
  $0 = $0 / $1
  $0 = $0 + N
end
return $0
0