結果
問題 |
No.276 連続する整数の和(1)
|
ユーザー |
![]() |
提出日時 | 2015-10-02 16:33:57 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 337 bytes |
コンパイル時間 | 476 ms |
コンパイル使用メモリ | 54,136 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-19 19:07:37 |
合計ジャッジ時間 | 987 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 3 WA * 7 |
ソースコード
#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<=n+1;++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; }