結果
問題 | No.278 連続する整数の和(2) |
ユーザー |
|
提出日時 | 2017-06-07 18:26:20 |
言語 | D (dmd 2.109.1) |
結果 |
AC
|
実行時間 | 13 ms / 2,000 ms |
コード長 | 395 bytes |
コンパイル時間 | 615 ms |
コンパイル使用メモリ | 100,324 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-12 19:46:12 |
合計ジャッジ時間 | 1,594 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 18 |
ソースコード
import std.algorithm, std.conv, std.range, std.stdio, std.string; import std.math; // math functions void main() { auto n = readln.chomp.to!long; auto y = n % 2 ? n : n / 2; auto my = y.to!real.sqrt.to!long + 1; auto r = 0L; foreach (s; 1..my+1) { if (y % s == 0) { r += s; auto t = y / s; if (s != t) { r += t; } } } writeln(r); }