結果

問題 No.3455 N-beatsu
コンテスト
ユーザー umezo
提出日時 2026-03-01 11:55:22
言語 C++23
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 733 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,372 ms
コンパイル使用メモリ 333,380 KB
実行使用メモリ 7,972 KB
最終ジャッジ日時 2026-03-01 12:56:55
合計ジャッジ時間 3,958 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n-1);i>=0;i--)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
template <class T> using V=vector<T>;
template <class T> using VV=V<V<T>>;
using u128=__int128_t;
using ll=long long;
 
int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  int n,q;
  cin>>n>>q;
  int m=1;
  while(m<=n) m*=10;
  
  while(q--){
    int x;
    cin>>x;
    if(x%n==0){
      cout<<"Yes\n";
      continue;
    }
    bool b=false;
    while(x){
      if(x%m==n){
        b=true;
        break;
      }
      x/=10;
    }
    if(b) cout<<"Yes\n";
    else cout<<"No\n";
  }
    
  return 0;
}
0