結果
問題 | No.1083 余りの余り |
ユーザー |
![]() |
提出日時 | 2020-06-19 21:28:44 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 119 ms / 3,000 ms |
コード長 | 525 bytes |
コンパイル時間 | 2,379 ms |
コンパイル使用メモリ | 200,148 KB |
最終ジャッジ日時 | 2025-01-11 05:45:18 |
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 31 |
ソースコード
#include <bits/stdc++.h>using namespace std;#ifdef LOCAL#include "debug.h"#else#define DEBUG(...)#endifint main() {cin.tie(nullptr);ios::sync_with_stdio(false);int n, k;cin >> n >> k;vector<int> a(n);for (auto&& e : a) cin >> e;sort(rbegin(a), rend(a));int res = 0;for (int bt = 1; bt < 1 << n; ++bt) {int cur = k;for (int i = 0; i < n; ++i) {if (bt >> i & 1) {cur %= a[i];}}cur %= a.back();res = max(res, cur);}cout << res << '\n';}