結果
| 問題 |
No.346 チワワ数え上げ問題
|
| コンテスト | |
| ユーザー |
shop_one
|
| 提出日時 | 2019-07-26 18:50:06 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 398 bytes |
| コンパイル時間 | 479 ms |
| コンパイル使用メモリ | 64,476 KB |
| 実行使用メモリ | 16,952 KB |
| 最終ジャッジ日時 | 2024-07-02 06:31:18 |
| 合計ジャッジ時間 | 6,884 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | TLE * 1 -- * 22 |
ソースコード
#include<iostream>
using namespace std;
int main(){
string s;
int w_cnt[100001]={};
long long sum = 0;
cin >> s;
for(int i=s.size()-1;i>=0;i++){
w_cnt[i]=w_cnt[i+1];
if(s[i]=='w') w_cnt[i]++;
}
for(int i=0;i<s.size();i++){
if(s[i]=='c'&&w_cnt[i]>=2){
sum += ((w_cnt[i]-1)*(w_cnt[i]))/2;
}
}
cout << sum << endl;
}
shop_one