結果
| 問題 |
No.346 チワワ数え上げ問題
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-10-08 13:16:42 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 426 bytes |
| コンパイル時間 | 1,281 ms |
| コンパイル使用メモリ | 158,176 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-06 22:23:30 |
| 合計ジャッジ時間 | 2,187 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | AC * 22 WA * 1 |
ソースコード
#include "bits/stdc++.h"
using namespace std;
typedef long long int ll;
int main(){
//階乗を前計算
string S;
cin >> S;
ll ans = 0;
//後ろから選んだほうが早い..?
ll count = 0;
for(ll i = S.length(); i > 0; i--){
if(S[i] == 'c'){
ans += count * (count - 1) / 2;
}else if(S[i] == 'w'){
count++;
}
}
cout << ans << endl;
}