結果
| 問題 |
No.346 チワワ数え上げ問題
|
| コンテスト | |
| ユーザー |
kotamanegi
|
| 提出日時 | 2016-02-26 23:12:40 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 798 bytes |
| コンパイル時間 | 603 ms |
| コンパイル使用メモリ | 81,772 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-22 22:45:21 |
| 合計ジャッジ時間 | 1,467 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 WA * 2 |
ソースコード
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include<map>
#include <list>
#include <typeinfo>
using namespace std;
#define REP(a,b) for(long long a = 0;a < b;++a)
int main() {
string joke;
cin >> joke;
string s;
for (int i = joke.length()-1;i >= 0;--i) {
s.push_back(joke[i]);
}
long long ans = 0;
int counter_w = 0;
for (int i = 0;i < s.length();++i) {
if (s[i] == 'w') {
counter_w++;
}
else if (s[i] == 'c') {
if (counter_w >= 2) ans += counter_w*(counter_w - 1) / 2;
}
}
cout << ans << endl;
}
kotamanegi