結果
問題 | No.276 連続する整数の和(1) |
ユーザー | hogeover30 |
提出日時 | 2015-10-02 16:33:02 |
言語 | C++11 (gcc 11.4.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 335 bytes |
コンパイル時間 | 393 ms |
コンパイル使用メモリ | 51,360 KB |
実行使用メモリ | 7,776 KB |
最終ジャッジ日時 | 2023-09-27 01:28:45 |
合計ジャッジ時間 | 4,924 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
7,776 KB |
testcase_01 | AC | 1 ms
4,376 KB |
testcase_02 | AC | 1 ms
4,380 KB |
testcase_03 | AC | 937 ms
4,380 KB |
testcase_04 | AC | 933 ms
4,380 KB |
testcase_05 | TLE | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
ソースコード
#include <iostream> using namespace std; int main() { long long n; cin>>n; auto a=n*(n+1)/2; auto b=(n+1)*(n+2)/2-1; auto res=1LL; for(auto i=1LL;i*i<=a;++i) { if (a%i==0) { if (b%i==0) res=max(res, i); if (b%(a/i)==0) res=max(res, a/i); } } cout<<res<<endl; }