結果
問題 | No.539 インクリメント |
ユーザー |
![]() |
提出日時 | 2017-06-30 23:35:59 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 488 bytes |
コンパイル時間 | 1,355 ms |
コンパイル使用メモリ | 168,852 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-04 21:43:29 |
合計ジャッジ時間 | 2,176 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | AC * 2 WA * 1 |
ソースコード
#include <bits/stdc++.h>using namespace std;void solve() {string s;getline(cin, s);reverse(s.begin(), s.end());bool f = false;for (int i = 0; i < s.size(); i++) {if (isdigit(s[i])) {if (s[i] == '9') {s[i] = '0';f = true;} else {s[i]++;break;}} else if (f) {s.insert(i, "1");break;}}reverse(s.begin(), s.end());cout << s << endl;}int main() {int T;cin >> T;cin.ignore();while (T--) {solve();}}