結果
| 問題 | No.3658 Darumaka Number 2 |
| コンテスト | |
| ユーザー |
tau1235
|
| 提出日時 | 2026-08-30 14:03:27 |
| 言語 | C++23 (gcc 15.3.0 + boost 1.92.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 503 bytes |
| 記録 | |
| コンパイル時間 | 2,073 ms |
| コンパイル使用メモリ | 331,976 KB |
| 実行使用メモリ | 6,272 KB |
| 最終ジャッジ日時 | 2026-08-30 14:03:32 |
| 合計ジャッジ時間 | 4,191 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 37 WA * 8 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
int main(){
string s;
cin>>s;
bool f=false;
string ans;
for (int i=0;i<(int)s.size();i++){
if (f||s[i]>'5') ans+='5',f=true;
else if (s[i]=='5') ans+='5';
else if (s[i]=='4') ans+='4';
else{
for (int i=(int)ans.size()-1;i>=0;i--){
if (ans[i]=='4') ans[i]='5';
else{
ans[i]='4';
f=true;
break;
}
}
if (!f) f=true;
ans+='5';
}
}
cout<<ans<<endl;
}
tau1235