結果

問題 No.346 チワワ数え上げ問題
ユーザー h_tyokinuhatah_tyokinuhata
提出日時 2016-02-28 00:54:41
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 511 bytes
コンパイル時間 1,856 ms
コンパイル使用メモリ 74,004 KB
実行使用メモリ 62,676 KB
最終ジャッジ日時 2023-10-24 18:42:20
合計ジャッジ時間 6,769 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
57,464 KB
testcase_01 AC 125 ms
57,288 KB
testcase_02 AC 113 ms
57,372 KB
testcase_03 AC 113 ms
57,344 KB
testcase_04 AC 123 ms
57,396 KB
testcase_05 AC 104 ms
56,152 KB
testcase_06 AC 127 ms
57,276 KB
testcase_07 AC 119 ms
57,416 KB
testcase_08 AC 111 ms
56,172 KB
testcase_09 AC 138 ms
57,224 KB
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String S = sc.next();
		
		char[] charS = S.toCharArray();
		
		int cnt = 0;
		
		for(int i = 0; i < S.length(); i++) {
			if(charS[i] == 'c') {
				for(int j = i + 1; j < S.length(); j++) {
					if(charS[j] == 'w') {
						for(int k = j + 1; k < S.length(); k++) {
							if(charS[k] == 'w') {
								cnt++;
							}
						}
					}
				}	
			}
		}
		
		System.out.println(cnt);
	}
}
0