結果

問題 No.1534 おなかがいたい
ユーザー nakamura0422nakamura0422
提出日時 2023-01-11 15:36:55
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 155 ms / 2,000 ms
コード長 447 bytes
コンパイル時間 8,809 ms
コンパイル使用メモリ 144,632 KB
実行使用メモリ 166,108 KB
最終ジャッジ日時 2023-08-23 22:05:57
合計ジャッジ時間 12,002 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
31,940 KB
testcase_01 AC 69 ms
29,616 KB
testcase_02 AC 67 ms
30,620 KB
testcase_03 AC 69 ms
29,884 KB
testcase_04 AC 68 ms
29,940 KB
testcase_05 AC 67 ms
29,680 KB
testcase_06 AC 67 ms
30,776 KB
testcase_07 AC 69 ms
31,664 KB
testcase_08 AC 69 ms
31,308 KB
testcase_09 AC 68 ms
30,340 KB
testcase_10 AC 68 ms
30,672 KB
testcase_11 AC 69 ms
31,544 KB
testcase_12 AC 85 ms
32,216 KB
testcase_13 AC 78 ms
31,568 KB
testcase_14 AC 79 ms
31,980 KB
testcase_15 AC 72 ms
32,268 KB
testcase_16 AC 113 ms
34,040 KB
testcase_17 AC 114 ms
33,968 KB
testcase_18 AC 113 ms
34,332 KB
testcase_19 AC 70 ms
31,796 KB
testcase_20 AC 155 ms
36,400 KB
testcase_21 AC 69 ms
29,936 KB
testcase_22 AC 67 ms
166,108 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  Determining projects to restore...
  Restored /home/judge/data/code/main.csproj (in 128 ms).
.NET 向け Microsoft (R) Build Engine バージョン 17.0.0-preview-21470-01+cb055d28f
Copyright (C) Microsoft Corporation.All rights reserved.

  プレビュー版の .NET を使用しています。https://aka.ms/dotnet-core-preview をご覧ください
  main -> /home/judge/data/code/bin/Release/net6.0/main.dll
  main -> /home/judge/data/code/bin/Release/net6.0/publish/

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;

static class Ponponpain
{
    static void Main()
    {
		var s = Console.ReadLine();
		var endIndex = s.IndexOf("pain");
		if(endIndex <= 0 )
			Console.WriteLine(-1);
		else
		{
			var pon = s.Substring(0, endIndex).Split('p').Where(x => x.StartsWith("on")).Count()-1;
			if(pon == 0)
			{
				Console.WriteLine(-1);
			} 
			else
			{
				Console.WriteLine(pon);
			}
		}
	}
}
0