結果
問題 |
No.505 カードの数式2
|
ユーザー |
|
提出日時 | 2019-10-12 08:01:12 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 326 bytes |
コンパイル時間 | 652 ms |
コンパイル使用メモリ | 76,900 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-27 07:42:45 |
合計ジャッジ時間 | 1,732 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
コンパイルメッセージ
main.cpp:7:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 7 | main() | ^~~~
ソースコード
#include<iostream> #include<algorithm> #include<vector> using namespace std; int N; long L,R; main() { cin>>N>>L;R=L; for(int i=1;i<N;i++) { long A;cin>>A; vector<long>X={L+A,R+A,L-A,R-A,L*A,R*A}; if(A!=0)X.push_back(L/A),X.push_back(R/A); sort(X.begin(),X.end()); L=X[0]; R=X[X.size()-1]; } cout<<R<<endl; }