結果
問題 | No.864 四方演算 |
ユーザー |
![]() |
提出日時 | 2019-08-16 21:59:37 |
言語 | Nim (2.2.0) |
結果 |
AC
|
実行時間 | 13 ms / 1,000 ms |
コード長 | 500 bytes |
コンパイル時間 | 3,220 ms |
コンパイル使用メモリ | 65,644 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-02 15:52:06 |
合計ジャッジ時間 | 4,180 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 8) Warning: imported and not used: 'sequtils' [UnusedImport]
ソースコード
import sequtils,strutils,algorithm var N = stdin.readline.parseBiggestInt K = stdin.readline.parseBiggestInt p : int64 = 1 y = newSeq[int64](0) ans : int64 = 0 while p * p <= K: if K mod p == 0: y.add(p) if p * p != K: y.add(K div p) p += 1 y.sort(cmp) var i = 0 j = y.high while j >= 0: ans += (max(0, min(N, y[i] - 1) - max(1, y[i] - N) + 1)) * (max(0, min(N, y[j] - 1) - max(1, y[j] - N) + 1)) i += 1 j -= 1 echo ans