結果
| 問題 | No.3455 N-beatsu |
| コンテスト | |
| ユーザー |
くらげ
|
| 提出日時 | 2026-02-19 11:52:38 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 16 ms / 2,000 ms |
| コード長 | 615 bytes |
| 記録 | |
| コンパイル時間 | 2,117 ms |
| コンパイル使用メモリ | 215,840 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2026-02-28 13:08:14 |
| 合計ジャッジ時間 | 2,963 ms |
|
ジャッジサーバーID (参考情報) |
judge7 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 10 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i) = 0; i<(n); i++)
bool is_substr(string s, string t){
int n = s.size(), m = t.size();
rep(d,n-m+1){
bool flag = true;
rep(i,m) if(s[i+d]!=t[i]) flag = false;
if(flag) return true;
}
return false;
}
int main(){
int n, q;
cin >> n >> q;
vector<int> x(q);
rep(i,q) cin >> x[i];
string ns = to_string(n);
rep(i,q){
bool ans = (x[i]%n==0);
if(is_substr(to_string(x[i]), ns)) ans = true;
cout << (ans? "Yes" : "No") << "\n";
}
}
くらげ