結果
| 問題 |
No.346 チワワ数え上げ問題
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-04-13 01:37:30 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 519 bytes |
| コンパイル時間 | 453 ms |
| コンパイル使用メモリ | 55,392 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-04 06:39:55 |
| 合計ジャッジ時間 | 1,417 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 WA * 2 |
ソースコード
#include <iostream>
#include <string>
using namespace std;
int main() {
int w_cnt=0, temp;
unsigned long long int sum;
string str;
cin >> str;
for(int i=0;i<str.length();++i)if(str[i]=='w')++w_cnt;
temp = sum = 0;
for(int i=0;i<str.length();++i){
if(str[i] == 'w'){
++temp;
}else if(str[i] == 'c'){
w_cnt -= temp;
sum += w_cnt * (w_cnt - 1) / 2;
temp = 0;
}
}
cout << sum << endl;
return 0;
}