結果

問題 No.423 ハムスター語初級(数詞)
コンテスト
ユーザー TrimozGit
提出日時 2017-09-04 18:05:20
言語 C#(csc)
(csc 3.9.0)
コンパイル:
csc -langversion:latest -unsafe -warn:0 -o+ /r:System.Numerics.dll _filename_ -out:a.exe
実行:
/usr/bin/mono a.exe
結果
AC  
実行時間 16 ms / 2,000 ms
コード長 965 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 571 ms
コンパイル使用メモリ 104,320 KB
実行使用メモリ 18,048 KB
最終ジャッジ日時 2026-05-07 02:49:03
合計ジャッジ時間 1,507 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 9
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #
raw source code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace yukicord423
{
	class Program
	{
		static void Main(string[] args)
		{
			string line = Console.ReadLine();

			int idx = 0;
			string num = "";
			string ans = "";

			if (leadingZero(line))
			{
				Console.WriteLine(line);
				Environment.Exit(0);
			}
			while (idx < line.Length - 1)
			{
				if (idx + 4 <= line.Length)
				{
					if (line.Substring(idx , 4) == "hamu")
					{
						num += "1";
						idx += 4;
					}
					else
					{
						num += "0";
						idx += 3;
					}
				}
				else
				{
					num += "0";
					idx += 3;

				}
			}
			num += "0";
			ans = num.Replace("1" , "hamu");
			ans = ans.Replace("0" , "ham");

			Console.WriteLine(ans);
			Console.ReadKey();
		}

		static bool leadingZero(string s)
		{
			if (s.Length < 4) return true;
			if (s.Substring(0 , 4) != "hamu") return true;

			return false;
		}
	}
}
0