結果

問題 No.2607 Add One Digit
ユーザー vjudge1
提出日時 2025-09-04 23:28:57
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 473 bytes
コンパイル時間 2,071 ms
コンパイル使用メモリ 196,912 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-09-04 23:29:01
合計ジャッジ時間 3,015 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main()
{
    string n;
    cin >> n;
    string a[1004];
    int b=0;
    for(int i=0; i<=n.size(); i++)
        for(char d='0'; d<='9'; d++)
        {
            string t=n.substr(0,i)+d+n.substr(i);
            if(t[0]=='0')
                continue;
            bool ok=true;
            for(int j=0; j<b; j++)
                if(a[j]==t) ok=false;
            if(ok)
                a[b++]=t;
        }
    cout<<b;
}
0