結果

問題 No.2607 Add One Digit
ユーザー srjywrdnprkt
提出日時 2024-02-09 16:37:05
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 515 bytes
コンパイル時間 4,261 ms
コンパイル使用メモリ 197,872 KB
最終ジャッジ日時 2025-02-19 03:00:34
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

    string s, t;
    cin >> s;
    auto check = [](string &t){
        return t[0] != '0';
    };

    int n = s.size();
    set<string> st;
    for (int i=0; i<=n; i++){
        for (int j=0; j<10; j++){
            t = s;
            t.insert(i, string(1, j+'0'));
            if (check(t)) st.insert(t);
        }
    }

    cout << st.size() << endl;

    return 0;
}
0