結果
| 問題 | No.346 チワワ数え上げ問題 |
| コンテスト | |
| ユーザー |
kpinkcat
|
| 提出日時 | 2023-11-16 19:39:46 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 665 bytes |
| 記録 | |
| コンパイル時間 | 742 ms |
| コンパイル使用メモリ | 129,656 KB |
| 実行使用メモリ | 6,528 KB |
| 最終ジャッジ日時 | 2026-07-03 00:32:30 |
| 合計ジャッジ時間 | 3,077 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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;
cin >> s;
for (int i = 0; i < s.size(); i++){
if (s[i] == 'c' || s[i] == 'w') t += s[i];
}
for (int i = 0; i < t.size(); i++){
if (t[i] == 'c'){
int cnt = 0;
for (int j = i+1; j < t.size(); j++){
if (t[j] == 'w') cnt++;
}
if (cnt >= 2) sum1 += cnt * (cnt - 1) / 2;
}
}
cout << sum1 << endl;
}
kpinkcat