結果
問題 | No.784 「,(カンマ)」 |
ユーザー |
![]() |
提出日時 | 2019-02-21 20:16:54 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 23 ms / 2,000 ms |
コード長 | 571 bytes |
コンパイル時間 | 2,140 ms |
コンパイル使用メモリ | 102,144 KB |
実行使用メモリ | 17,408 KB |
最終ジャッジ日時 | 2024-11-20 20:25:26 |
合計ジャッジ時間 | 2,244 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
コンパイルメッセージ
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(); if (s.Length <= 3) { Console.WriteLine(s); goto exit; } var a = s.Length % 3; if (a != 0 ) Console.Write(s.Substring(0, a) + ","); put3N(s.Substring(a)); exit:; } 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(); } }