結果
| 問題 |
No.346 チワワ数え上げ問題
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-04-30 21:19:43 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 365 bytes |
| コンパイル時間 | 516 ms |
| コンパイル使用メモリ | 64,500 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-27 23:59:11 |
| 合計ジャッジ時間 | 1,931 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 WA * 2 |
ソースコード
#include<iostream>
using namespace std;
int main(){
string s;
cin >> s;
int len = s.length();
int w = 0;
long long res = 0;
char c;
for(int i = 1; i <= len; i++){
c = s[len-i];
if(c == 'c' && w >= 2){
res += w*(w-1)/2;
}
if(c == 'w') w++;
}
cout << res << endl;
return 0;
}