結果
問題 | No.152 貯金箱の消失 |
ユーザー |
|
提出日時 | 2019-01-27 01:10:47 |
言語 | Nim (2.2.0) |
結果 |
AC
|
実行時間 | 70 ms / 5,000 ms |
コード長 | 499 bytes |
コンパイル時間 | 2,271 ms |
コンパイル使用メモリ | 60,836 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-01 10:59:26 |
合計ジャッジ時間 | 3,276 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 12 |
ソースコード
import math proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "<stdio.h>" .} proc scan(): int = while true: let k = getchar_unlocked() if k < '0': break result = 10 * result + k.ord - '0'.ord proc solve(n:int):int = for x in 1..n: for y in (x+1)..n: let a = (x * x - y * y).abs let b = 2 * x * y let c = x * x + y * y if a + b + c > n : break if a.gcd(b).gcd(c) != 1 : continue result += 1 let n = scan() div 4 echo n.solve()