結果
| 問題 |
No.3157 Nabeatsu
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-07-11 16:01:12 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 906 bytes |
| コンパイル時間 | 3,661 ms |
| コンパイル使用メモリ | 275,288 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-07-11 16:01:19 |
| 合計ジャッジ時間 | 5,614 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 WA * 7 |
ソースコード
#ifndef ONLINE_JUDGE
#define _GLIBCXX_DEBUG // []で配列外参照をするとエラーにしてくれる。上下のやつがないとTLEになるので注意
#endif
#include <bits/stdc++.h>
using namespace std;
// #include <atcoder/all>
// using namespace atcoder;
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
using ll = long long;
using Graph = vector<vector<int>>;
ll INF = 2e18 + 1;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
string S;
int sum = 0;
cin >> S;
bool ok = true;
for (int i = 0; i < S.size()-1; i++)
{
if (ok &&S[i]=='3')
{S[i] = '2';
ok = false;
sum += S[i];
continue;
}
if (!ok) {
S[i] = '9';
}
sum += S[i];
}
if(!ok) S[S.size() - 1] = (sum % 3 == 0 ? '8' : '9');
cout << S << endl;
}