結果

問題 No.3157 Nabeatsu
ユーザー VvyLw
提出日時 2025-05-29 12:39:51
言語 D
(dmd 2.109.1)
結果
WA  
実行時間 -
コード長 455 bytes
コンパイル時間 1,847 ms
コンパイル使用メモリ 158,952 KB
実行使用メモリ 7,948 KB
最終ジャッジ日時 2025-05-29 12:40:01
合計ジャッジ時間 5,865 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 31 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

import std;

void main() {
    auto n = readln.chomp.dup;
    const len = n.length;
    int id = -1;
    foreach(i, c; n) {
        if(c == '3') {
            id = cast(int)i;
            break;
        }
    }
    const s = n[0..id] ~ "2" ~ "9".replicate(len - id - 1);
    int p = 0;
    foreach(c; s) {
        const m = c - '0';
        p += m;
    }
    const d = ((((s[$ - 1] - '0') - (p % 3 == 0)) + 10) % 10) + '0';
    writeln(s[0..$ - 1] ~ d);
}
0