結果
問題 | No.1083 余りの余り |
ユーザー | kotatsugame |
提出日時 | 2020-06-19 21:31:24 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 55 ms / 3,000 ms |
コード長 | 309 bytes |
コンパイル時間 | 597 ms |
コンパイル使用メモリ | 70,664 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-03 13:57:38 |
合計ジャッジ時間 | 1,938 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 31 |
コンパイルメッセージ
main.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 5 | main() | ^~~~
ソースコード
#include<iostream> #include<algorithm> using namespace std; int N,K,A[20]; main() { cin>>N>>K; for(int i=0;i<N;i++)cin>>A[i]; sort(A,A+N); reverse(A,A+N); int ans=0; for(int i=0;i<1<<N-1;i++) { int now=K; for(int j=0;j<N-1;j++)if(i>>j&1)now%=A[j]; ans=max(ans,now%A[N-1]); } cout<<ans<<endl; }