結果
| 問題 | No.346 チワワ数え上げ問題 |
| コンテスト | |
| ユーザー |
nglkrianbrjf
|
| 提出日時 | 2016-02-26 23:07:38 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 697 bytes |
| 記録 | |
| コンパイル時間 | 2,685 ms |
| コンパイル使用メモリ | 82,644 KB |
| 実行使用メモリ | 45,248 KB |
| 最終ジャッジ日時 | 2026-04-11 04:58:18 |
| 合計ジャッジ時間 | 4,842 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 WA * 9 |
ソースコード
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class QuestionA {
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;//直前のcの位置
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);
}
}
nglkrianbrjf