結果

問題 No.1083 余りの余り
ユーザー ate
提出日時 2020-06-19 23:20:05
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 349 bytes
コンパイル時間 2,272 ms
コンパイル使用メモリ 193,676 KB
最終ジャッジ日時 2025-01-11 08:02:25
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

signed main(){

  int64_t n,k;
  cin>>n>>k;
  vector<int64_t> a(n);
  for(auto& ai:a)cin>>ai;

  int64_t ans = 0;
  auto ok = [&](auto val){
    for(auto const& ai:a)if(ai<=val)return false;
    return true;
  };
  for(int i=0;i<n;++i){
    if(ok(k%a[i]))ans=max(ans,k%a[i]);
  }
  cout<<(ans)<<endl;

}
0