結果
問題 |
No.3157 Nabeatsu
|
ユーザー |
![]() |
提出日時 | 2025-05-29 21:11:04 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 446 bytes |
コンパイル時間 | 1,216 ms |
コンパイル使用メモリ | 83,692 KB |
実行使用メモリ | 7,848 KB |
最終ジャッジ日時 | 2025-05-29 21:11:08 |
合計ジャッジ時間 | 3,927 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 2 |
other | AC * 20 WA * 25 |
ソースコード
#include<iostream> #include<vector> using namespace std; int main(){ string S;cin>>S; int N=S.size(); int sum = 0; for(int i=0;i<N;++i){ sum += S[i]-'0'; } if(sum%3){ cout << S << endl; } else { int idx=N-1; if(S[idx]=='0'){ S[idx]='9'; idx--; } S[idx]--; bool isFound = false; for(int i=0;i<N;++i){ if(isFound)S[i]='9'; else if(S[i]=='3'){ S[i]='2'; isFound = true; } } cout << S << endl; } }