結果
問題 | No.1083 余りの余り |
ユーザー |
![]() |
提出日時 | 2020-06-19 22:56:52 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 670 bytes |
コンパイル時間 | 1,451 ms |
コンパイル使用メモリ | 95,532 KB |
最終ジャッジ日時 | 2025-01-11 07:40:35 |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 WA * 4 |
ソースコード
#include <iostream> #include <vector> #include <string> #include <algorithm> #include <cstdio> #include <cstring> #include <cmath> using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, k; cin >> n >> k; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a.rbegin(), a.rend()); int r = 0; for (int x = 1; x < 1 << (n - 1); x++) { int t = k; for (int i = 0; i < n - 1; i++) { if (x >> i & 1) { t %= a[i]; } } r = max(r, t % a.back()); } cout << r << endl; return 0; }