結果
問題 | No.346 チワワ数え上げ問題 |
ユーザー | nglkrianbrjf |
提出日時 | 2016-02-27 00:07:28 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 677 bytes |
コンパイル時間 | 3,740 ms |
コンパイル使用メモリ | 75,120 KB |
実行使用メモリ | 54,404 KB |
最終ジャッジ日時 | 2023-10-24 17:59:56 |
合計ジャッジ時間 | 5,540 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 52 ms
53,536 KB |
testcase_01 | AC | 52 ms
53,540 KB |
testcase_02 | AC | 52 ms
53,548 KB |
testcase_03 | AC | 51 ms
53,544 KB |
testcase_04 | AC | 51 ms
52,536 KB |
testcase_05 | AC | 50 ms
51,500 KB |
testcase_06 | AC | 55 ms
53,544 KB |
testcase_07 | AC | 52 ms
53,496 KB |
testcase_08 | AC | 51 ms
52,556 KB |
testcase_09 | AC | 50 ms
53,536 KB |
testcase_10 | WA | - |
testcase_11 | AC | 66 ms
54,096 KB |
testcase_12 | WA | - |
testcase_13 | AC | 65 ms
53,544 KB |
testcase_14 | AC | 54 ms
53,536 KB |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | AC | 79 ms
54,392 KB |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | AC | 52 ms
53,548 KB |
testcase_24 | AC | 52 ms
52,528 KB |
testcase_25 | AC | 51 ms
52,532 KB |
ソースコード
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class QuestionB { public static void main(String[] args) { // TODO 自動生成されたメソッド・スタブ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line; try{ line = in.readLine(); }catch(IOException e){ System.out.println("0"); return; } int result = 0; int wcount = 0; boolean check = false; for(int i = line.length() - 1; i >= 0; i--){ if(line.charAt(i) == 'c') result += wcount * (wcount - 1)/2; if(line.charAt(i) == 'w'){ wcount++; } } System.out.println(result); } }