結果
| 問題 |
No.2607 Add One Digit
|
| コンテスト | |
| ユーザー |
forest3
|
| 提出日時 | 2024-02-13 15:51:55 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 522 bytes |
| コンパイル時間 | 1,719 ms |
| コンパイル使用メモリ | 175,836 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-09-28 18:30:24 |
| 合計ジャッジ時間 | 2,064 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < n; i++)
int main() {
string s;
cin >> s;
int N = s.size();
set<ll> st;
rep(i, N) {
rep(j, 10) {
string c(1, (char)(j + '0'));
string t = s.substr(0, i + 1) + c + s.substr(i + 1, N - i - 1);
ll n = atoll(t.c_str());
st.insert(n);
}
}
for(int i = 1; i < 10; i++ ) {
string c(1, (char)(i + '0'));
string t = c + s;
ll n = atoll(t.c_str());
st.insert(n);
}
cout << st.size() << endl;
}
forest3