結果
問題 | No.276 連続する整数の和(1) |
ユーザー |
|
提出日時 | 2020-05-01 17:19:00 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 552 bytes |
コンパイル時間 | 1,648 ms |
コンパイル使用メモリ | 167,960 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-24 10:39:08 |
合計ジャッジ時間 | 2,079 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
ソースコード
#include <bits/stdc++.h>#define rep(i,n) for(int i=0;i<(int)(n);i++)using namespace std;using ll = long long ;using P = pair<int,int> ;using pll = pair<ll,ll>;constexpr int INF = 1e9;constexpr ll LINF = 1e18;constexpr int MOD = 1000000007;int main(){ll n;cin >> n;ll m = n*(n-1)/2;ll ans = 0;for(ll i=1;i*i<=n;i++){if(n%i == 0 && m%i == 0){ans = max(ans,i);}if(n%i ==0 && m%(n/i) == 0){ans = max(ans,n/i);}}cout << ans << endl;return 0;}