結果

問題 No.2437 Fragile Multiples of 11
ユーザー ebi_flyebi_fly
提出日時 2023-08-12 01:59:16
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 892 bytes
コンパイル時間 2,334 ms
コンパイル使用メモリ 204,216 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-04-29 16:42:04
合計ジャッジ時間 5,543 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
10,752 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#include <atcoder/modint>

#define rep(i,s,n) for(int i = int(s); i < int(n); i++)

using i64 = std::int64_t;

using mint = atcoder::modint998244353;

int main() {
    int n;
    int x;
    std::cin >> n >> x;
    mint ans = 0;
    rep(i,11,x+1) {
        if(i % 11 != 0) continue;
        std::vector<int> p;
        {
            int ret = i;
            while(ret > 0) {
                p.emplace_back(ret % 10);
                ret /= 10;
            }
            std::reverse(p.begin(), p.end());
        }
        int sz = p.size();
        bool is_ok = true;
        rep(j,0,sz) {
            int now = 0;
            rep(k,0,sz) {
                if(k == j) continue;
                now = now * 10 + p[k];
                now %= 11;
            }
            is_ok &= now != 0;
        }
        if(is_ok) ans++;
    }
    std::cout << ans.val() << '\n';
}
0