結果
| 問題 | No.3455 N-beatsu |
| コンテスト | |
| ユーザー |
startcpp
|
| 提出日時 | 2026-02-28 14:08:51 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 787 bytes |
| 記録 | |
| コンパイル時間 | 946 ms |
| コンパイル使用メモリ | 79,976 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2026-02-28 14:08:58 |
| 合計ジャッジ時間 | 1,928 ms |
|
ジャッジサーバーID (参考情報) |
judge7 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 1 WA * 9 |
ソースコード
#include <iostream>
#include <string>
#include <algorithm>
#include <cassert>
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;
int n, q;
string toS(int x) {
string s;
while (x > 0) {
s += x % 10 + '0';
x /= 10;
}
reverse(s.begin(), s.end());
return s;
}
bool isSubstr(string s, string t) {
for (int i = 0; i < (int)s.length() - t.length() + 1; i++) {
bool ok = true;
for (int j = 0; j < t.length(); j++) {
if (s[i + j] != t[j]) { ok = false; break; }
}
if (ok) return true;
}
return false;
}
int main() {
int i;
cin >> n >> q;
assert(1 <= n && n <= 1000);
rep(i, q) {
int x; cin >> x;
assert(1 <= x && x <= 20000);
if (x % n == 0 || isSubstr(toS(x), toS(n))) { cout << "Yes" << endl; }
else { cout << "No" << endl; }
}
return 0;
}
startcpp