結果
| 問題 |
No.346 チワワ数え上げ問題
|
| コンテスト | |
| ユーザー |
kpinkcat
|
| 提出日時 | 2023-11-16 19:52:24 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 515 bytes |
| コンパイル時間 | 925 ms |
| コンパイル使用メモリ | 106,920 KB |
| 最終ジャッジ日時 | 2025-02-17 22:18:24 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 WA * 2 |
ソースコード
#include<iostream>
#include<string>
#include<algorithm>
#include<cctype>
#include<set>
#include<bitset>
#include<math.h>
#include<map>
#include<queue>
#include<iomanip>
using namespace std;
using ll = long long;
int main()
{
string s, t;
ll sum1 = 0, cnt = 0;
vector<int> v;
cin >> s;
for (int i = s.size() -1; i >= 0; i--){
if (s[i] == 'c') v.push_back(cnt);
if (s[i] == 'w') cnt++;
}
for (auto x : v){
sum1 += x * (x- 1) / 2;
}
cout << sum1 << endl;
}
kpinkcat