結果
問題 | No.1849 Three Times Value |
ユーザー |
![]() |
提出日時 | 2023-08-23 19:24:28 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 681 bytes |
コンパイル時間 | 2,999 ms |
コンパイル使用メモリ | 108,312 KB |
実行使用メモリ | 27,728 KB |
最終ジャッジ日時 | 2024-12-22 03:16:17 |
合計ジャッジ時間 | 5,004 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 1 RE * 1 |
other | AC * 9 WA * 14 RE * 3 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;public class Hello{static void Main(){var s = Console.ReadLine().Trim();getAns(s);}static void getAns(string s){var n = s.Length;if (n % 3 != 0){var w = n / 3;Console.WriteLine(new string('9', w));}else{var w = n / 3;var ws = s.Substring(0, w);var ww = int.Parse(ws);var www = long.Parse(ws + ws + ws);var ww2 = int.Parse(new string('9', w - 1));var ans = ww + ww2;if (www < long.Parse(s)) ans--;Console.WriteLine(ans);}}}