結果

問題 No.3535 $E\times - Otogibanashi$
コンテスト
ユーザー t98slider
提出日時 2026-05-08 21:50:58
言語 C++23
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 157 ms / 2,000 ms
コード長 692 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 6,083 ms
コンパイル使用メモリ 377,168 KB
実行使用メモリ 19,960 KB
最終ジャッジ日時 2026-05-08 21:51:11
合計ジャッジ時間 10,527 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using ll = long long;
using mint = atcoder::modint;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n;
    int p;
    cin >> n >> p;
    mint::set_mod(p);
    vector<int> S;
    mint ans;
    for(int i = 1; i <= 9; i++){
        for(int j = 0; j <= 9; j++){
            for(int k = 0; k <= 9; k++){
                int v = 110000 * i + 1001 * j + 110 * k;
                for(int l = 1; l * v <= n; l++) S.emplace_back(l * v);
            }
        }
    }
    sort(S.begin(), S.end());
    S.erase(unique(S.begin(), S.end()), S.end());
    for(auto &&v : S) ans -= v;
    cout << ans.val() << '\n';
}
0