結果

問題 No.1534 おなかがいたい
ユーザー bluemeganebluemegane
提出日時 2021-06-07 15:20:03
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 86 ms / 2,000 ms
コード長 443 bytes
コンパイル時間 946 ms
コンパイル使用メモリ 65,332 KB
実行使用メモリ 24,488 KB
最終ジャッジ日時 2023-08-16 08:05:05
合計ジャッジ時間 3,546 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
21,192 KB
testcase_01 AC 71 ms
21,208 KB
testcase_02 AC 71 ms
23,236 KB
testcase_03 AC 72 ms
23,320 KB
testcase_04 AC 70 ms
21,196 KB
testcase_05 AC 69 ms
21,268 KB
testcase_06 AC 74 ms
23,560 KB
testcase_07 AC 68 ms
23,180 KB
testcase_08 AC 72 ms
23,104 KB
testcase_09 AC 71 ms
21,144 KB
testcase_10 AC 69 ms
19,176 KB
testcase_11 AC 70 ms
21,188 KB
testcase_12 AC 77 ms
20,284 KB
testcase_13 AC 73 ms
21,660 KB
testcase_14 AC 75 ms
21,664 KB
testcase_15 AC 74 ms
21,736 KB
testcase_16 AC 86 ms
24,436 KB
testcase_17 AC 84 ms
22,428 KB
testcase_18 AC 86 ms
24,488 KB
testcase_19 AC 71 ms
23,660 KB
testcase_20 AC 75 ms
22,168 KB
testcase_21 AC 71 ms
21,188 KB
testcase_22 AC 72 ms
21,208 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;

public class Hello
{
    static void Main()
    {
        var s = Console.ReadLine().Trim();
        getAns(s);
    }
    static void getAns(string s)
    {
        var p = s.IndexOf("pain");
        if (p == -1) { Console.WriteLine(-1); return; }
        var t = s.Substring(0, p);
        var tL = t.Length;
        var ans = (tL - t.Replace("pon", "").Length) / 3 - 1;
        Console.WriteLine(ans == 0 ? -1 : ans);
    }
}
0