結果

問題 No.667 Mice's Luck(ネズミ達の運)
ユーザー ixTL255ixTL255
提出日時 2018-07-10 23:03:06
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 764 ms / 2,000 ms
コード長 471 bytes
コンパイル時間 5,724 ms
コンパイル使用メモリ 103,996 KB
実行使用メモリ 29,268 KB
最終ジャッジ日時 2023-10-12 00:10:58
合計ジャッジ時間 7,080 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
20,212 KB
testcase_01 AC 57 ms
20,468 KB
testcase_02 AC 60 ms
24,484 KB
testcase_03 AC 60 ms
20,488 KB
testcase_04 AC 73 ms
22,696 KB
testcase_05 AC 137 ms
22,752 KB
testcase_06 AC 422 ms
25,184 KB
testcase_07 AC 764 ms
29,268 KB
testcase_08 AC 583 ms
24,588 KB
testcase_09 AC 504 ms
24,112 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 Yuki667
{
	public static void Main()
	{
		var s = Console.ReadLine();
		var x = CountChar(s, 'x');
		var l = s.Length;

		foreach(char c in s)
		{
			if(x == 0)
			{
				Console.WriteLine(100.0);
				continue;
			}
			else
			{
				Console.WriteLine(((double)(l - x) / l) * 100);
				if(c == 'x') x -= 1;
				l -= 1;
			}
		}
	}
	
	private static int CountChar(string s, char c)
	{
		return s.Length - s.Replace(c.ToString(), "").Length;
	}

}
0