結果
| 問題 | No.3455 N-beatsu |
| コンテスト | |
| ユーザー |
rinrion
|
| 提出日時 | 2026-02-28 14:15:38 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 82 ms / 2,000 ms |
| コード長 | 1,215 bytes |
| 記録 | |
| コンパイル時間 | 4,239 ms |
| コンパイル使用メモリ | 249,644 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2026-02-28 14:15:45 |
| 合計ジャッジ時間 | 5,365 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge7 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 10 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vs = vector<string>;
using vp = vector<pair<int, int>>;
#define rep(i, s, n) for (int i = (s); i < (int)(n); ++i)
#define repr(i, s, n) for (int i = (s); i >= (int)(n); --i)
#define sz(x) ((int)(x).size())
constexpr int INFI = 1001001001;
constexpr ll INFL = (1LL << 60);
string to_string(long long x) {
if (x == 0) return "0";
string res;
bool negative = false;
if (x < 0) {
negative = true;
x = -x;
}
while (x > 0) {
res += '0' + (x % 10);
x /= 10;
}
if (negative) res += '-';
reverse(res.begin(), res.end());
return res;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, q;
cin >> n >> q;
vi a (q);
rep(i, 0, q){
cin >> a[i];
}
string s = to_string(n);
rep (i, 0, q){
bool jdg = 1;
int x = a[i];
string t = to_string(x);
int idx = t.find(s) == string::npos ? -1 : s.find(s);
if(x % n == 0 || idx != -1){
cout << (jdg ? "Yes" : "No") << endl;
}
else{
jdg = 0;
cout << (jdg ? "Yes" : "No") << endl;
}
}
return 0;
}
rinrion