結果
| 問題 | No.278 連続する整数の和(2) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-06-07 18:26:20 |
| 言語 | D (dmd 2.112.0) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 2,000 ms |
| コード長 | 395 bytes |
| 記録 | |
| コンパイル時間 | 533 ms |
| コンパイル使用メモリ | 83,824 KB |
| 実行使用メモリ | 7,720 KB |
| 最終ジャッジ日時 | 2026-03-05 15:00:23 |
| 合計ジャッジ時間 | 1,191 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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);
}