結果

問題 No.784 「,(カンマ)」
ユーザー bluemeganebluemegane
提出日時 2019-02-21 20:13:39
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 491 bytes
コンパイル時間 2,068 ms
コンパイル使用メモリ 105,664 KB
実行使用メモリ 25,680 KB
最終ジャッジ日時 2024-04-30 22:08:38
合計ジャッジ時間 2,078 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 24 ms
25,404 KB
testcase_01 AC 25 ms
25,432 KB
testcase_02 AC 23 ms
21,680 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 24 ms
23,728 KB
testcase_06 AC 24 ms
23,600 KB
testcase_07 AC 24 ms
25,412 KB
testcase_08 AC 24 ms
25,156 KB
testcase_09 AC 24 ms
25,304 KB
testcase_10 AC 24 ms
23,384 KB
testcase_11 AC 24 ms
23,396 KB
testcase_12 AC 24 ms
23,496 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

public class Hello
{
    static void Main()
    {
        var s = Console.ReadLine().Trim();
        var a = s.Length % 3;
        if (a != 0) Console.Write(s.Substring(0, a) + ",");
        put3N(s.Substring(a));
    }
    static void put3N(string s)
    {
        var sL = s.Length;
        for (int i = 0; i < sL; i++)
        {
            Console.Write(s[i]);
            if (i % 3 == 2 && i != sL - 1) Console.Write(',');
        }
        Console.WriteLine();
    }
}

0