結果

問題 No.3157 Nabeatsu
ユーザー ロロット
提出日時 2025-07-11 15:58:47
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 898 bytes
コンパイル時間 3,488 ms
コンパイル使用メモリ 275,868 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-07-11 15:58:54
合計ジャッジ時間 6,741 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#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];
    }
    S[S.size() - 1] = (sum % 3 == 0 ? '8' : '9');
    cout << S << endl;
}
0