結果
| 問題 |
No.539 インクリメント
|
| コンテスト | |
| ユーザー |
y_taira_c
|
| 提出日時 | 2017-07-02 14:09:15 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
OLE
|
| 実行時間 | - |
| コード長 | 1,965 bytes |
| コンパイル時間 | 777 ms |
| コンパイル使用メモリ | 72,044 KB |
| 実行使用メモリ | 6,816 KB |
| 最終ジャッジ日時 | 2024-10-05 07:30:38 |
| 合計ジャッジ時間 | 1,789 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | RE * 2 OLE * 1 |
ソースコード
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <iostream>
#include <set>
#include <string>
#include <vector>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
#define REP(i,n) for(ll i=0; i<n; ++i )
#define REPR(i,n) for( ll i=n; i>=0; --i)
#define REPS(i,n,s) for(ll i=0; i<n; i+=s )
#define REPSR(i,n,s) for( ll i=n; i>=0; i-=s)
#define FOR(i,a,n) for(ll i=a; i<n; ++i )
#define FORR(i,a,n) for(ll i=n; i>=a; --i)
#define FORS(i,a,n,s) for(ll i=a; i<n; i+=s )
#define FORSR(i,a,n,s) for(ll i=n; i>=a; i-=s)
#define VDOUT(x) cerr << #x << "\n";for(auto i : x ) cerr << " " << i << "\n";
#define DOUT(x) cerr << #x << " = " << x << "\n";
#define COUT(x) cout << x << "\n";
#define COUT2(x,y) cout <<x << " " << y << "\n";
#define COUT3(x,y,z) cout <<x << " " << y << " " << z << "\n";
#define INI ios::sync_with_stdio(false);cin.tie(0)
#define ALL(x) x.begin(),x.end()
int main()
{
INI;
int n;
cin >> n;
cin.ignore();
string num, txt_s, txt_e;
REP(loop,n)
{
string s;
getline(cin, s);
vector<string> vs;
REPS(keta, s.length(), 1000)
{
int sz = s.length() > keta + 1000 ? keta + 1000 : s.length();
vs.push_back(s.substr(keta, sz));
}
REPR(i, vs.size()-1)
{
num = "";
txt_s = "";
txt_e = "";
REPR(er, vs[i].length() - 1)
{
if (vs[i][er] >= '0' && vs[i][er] <= '9')
{
num = vs[i][er] + num;
}
else if (num != "")
{
txt_s = vs[i].substr(0, er + 1);
break;
}
else
{
txt_e = vs[i][er] + txt_e;
}
}
bool flag = true;
if (num != "")
{
string tnum = to_string(stoull(num) + 1);
int c = num.length() - tnum.length();
REP(k, c)
{
tnum = "0" + tnum;
}
if (num.length() < tnum.length())flag = false;
num = tnum;
}
vs[i] = txt_s + num + txt_e;
if (txt_s != "" || !flag) break;
}
REP(i, vs.size())
{
cout << vs[i];
}
cout << "\n";
}
return 0;
}
y_taira_c