結果
問題 | No.944 煎っぞ! |
ユーザー |
![]() |
提出日時 | 2020-04-02 17:26:58 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 85 ms / 3,000 ms |
コード長 | 695 bytes |
コンパイル時間 | 2,579 ms |
コンパイル使用メモリ | 193,784 KB |
最終ジャッジ日時 | 2025-01-09 12:32:20 |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 35 |
ソースコード
#include <bits/stdc++.h> using namespace std; template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;} using Int = long long; const char newl = '\n'; //INSERT ABOVE HERE signed main(){ cin.tie(0); ios::sync_with_stdio(0); Int n; cin>>n; vector<Int> as(n); for(Int i=0;i<n;i++) cin>>as[i]; Int sum=0; for(Int a:as) sum+=a; Int ans=0; for(Int i=1;i<=sum;i++){ if(sum%i) continue; Int res=0,flg=1; for(Int a:as){ res+=a; if(res<i) continue; if(res>i) flg=0; res=0; } if(flg) chmax(ans,sum/i); } cout<<ans<<newl; return 0; }