結果

問題 No.2007 Arbitrary Mod (Easy)
ユーザー toshiro_yanagi
提出日時 2022-08-04 22:55:24
言語 Nim
(2.2.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 448 bytes
コンパイル時間 3,736 ms
コンパイル使用メモリ 64,544 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-14 19:29:54
合計ジャッジ時間 6,307 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

import strutils, math

proc pInt(s: auto): int = parseInt($s)
proc input(): string =
  while not stdin.endOfFile:
    let c = stdin.readChar
    if c == '\r': continue
    if c in [' ', '\n']: break
    result.add c


proc main(): void =
  let
    a, n = pInt(input())
  var
    m = 1
    k = 0
    ans: int

  while m < 10^7:
    m *= a
    k += 1

  if k <= n:
    ans = 0
  else:
    ans = a^n

  echo m
  echo ans


when isMainModule:
  main()
0