結果
問題 | No.276 連続する整数の和(1) |
ユーザー | tonyu0 |
提出日時 | 2020-04-29 15:49:25 |
言語 | Rust (1.77.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 568 bytes |
コンパイル時間 | 6,382 ms |
コンパイル使用メモリ | 128,796 KB |
実行使用メモリ | 8,760 KB |
最終ジャッジ日時 | 2023-08-19 06:02:07 |
合計ジャッジ時間 | 5,874 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge10 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 0 ms
8,760 KB |
testcase_01 | AC | 1 ms
4,380 KB |
testcase_02 | AC | 0 ms
4,376 KB |
testcase_03 | AC | 785 ms
4,376 KB |
testcase_04 | AC | 813 ms
4,376 KB |
testcase_05 | TLE | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
ソースコード
use std::cmp::max; use std::io::*; fn main() { let mut s: String = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let mut itr = s.trim().split_whitespace(); let n: u64 = itr.next().unwrap().parse().unwrap(); let m = n * (n + 1) / 2; let mut ans = 0; let mut i = 1; while i * i <= m { if m % i == 0 { if i <= n { ans = max(ans, i); } if m / i <= n { ans = max(ans, m / i) } } i += 1; } println!("{}", ans); }