結果

問題 No.2607 Add One Digit
ユーザー Yaowei Lyu
提出日時 2024-01-19 21:26:14
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 548 bytes
コンパイル時間 2,718 ms
コンパイル使用メモリ 251,668 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-28 03:56:40
合計ジャッジ時間 3,379 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
int main() {
  cin.tie(nullptr)->sync_with_stdio(false);
  cout << fixed << setprecision(20);
  int t = 1;
  for (int ti = 0; ti < t; ti += 1) {
    int n;
    cin >> n;
    auto s = to_string(n);
    set<string> ss;
    for (char c = '0'; c <= '9'; c += 1) {
      for (int i = 0; i <= ssize(s); i += 1) {
        if (not i and c == '0') { continue; }
        auto t = s;
        t.insert(t.begin() + i, c);
        ss.insert(t);
      }
    }
    cout << ss.size() << "\n";
  }
}
0