結果

問題 No.3455 N-beatsu
コンテスト
ユーザー おのせ
提出日時 2026-02-10 22:28:41
言語 C++17
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 95 ms / 2,000 ms
コード長 1,585 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 4,935 ms
コンパイル使用メモリ 277,308 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2026-02-28 13:06:39
合計ジャッジ時間 6,223 ms
ジャッジサーバーID
(参考情報)
judge1 / judge7
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
#include <atcoder/all>
#include <iostream>
#include <cmath>
using namespace std;
using namespace atcoder;
using ll = long long;
using lb = long double;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vb = vector<bool>;
using vvll = vector<vector<ll>>;
using vP = vector<P>;
using Graph = vector<vector<ll>>;
using WGraph = vector<vector<pair<ll, ll>>>; // コスト、頂点番号の順
using mint = modint998244353;
//using mint = long double;
#define rep0(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++)
mt19937_64 rng(58);
long double PI = 3.14159265358979;
const ll LLMAX = 9223372036854775807;
const ll INF = 1e18;
vector<ll> di = {-1, 0, 1, 0}; // 上左下右
vector<ll> dj = {0, -1, 0, 1};
template<typename T> inline bool chmax(T &a, T b) { return ((a < b) ? (a = b, true) : (false)); }
template<typename T> inline bool chmin(T &a, T b) { return ((a > b) ? (a = b, true) : (false)); }

int main() {
    ll n, q;
    cin >> n >> q;

    string N = to_string(n);
    rep0 (qi, q) {
        ll x;
        cin >> x;
        string X = to_string(x);

        bool sec = false;
        rep0 (i, X.size()) {
            bool corr = true;
            rep0 (j, N.size()) {
                if (i + j >= X.size() || X[i + j] != N[j]) {
                    corr = false;
                    break;
                }
            }
            if (corr) sec = true;
        }
        if (x % n == 0 || sec) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}
0