結果
| 問題 | No.346 チワワ数え上げ問題 |
| コンテスト | |
| ユーザー |
ldsyb
|
| 提出日時 | 2016-03-03 21:46:23 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 319 bytes |
| 記録 | |
| コンパイル時間 | 422 ms |
| コンパイル使用メモリ | 55,512 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-24 13:56:27 |
| 合計ジャッジ時間 | 1,223 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | AC * 22 WA * 1 |
ソースコード
#include <iostream>
#include <string>
using namespace std;
//4STEP 数学1+AのP.100参照
int main(){
string s;
cin >> s;
long long ans = 0,count = 0;
for(int i = s.size() - 1;i != 0;i--){
if(s[i] == 'w') count++;
if(s[i] == 'c') ans += count * (count - 1) / 2;
}
cout << ans << endl;
}
ldsyb