結果
| 問題 |
No.346 チワワ数え上げ問題
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-02-26 22:34:51 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 333 bytes |
| コンパイル時間 | 415 ms |
| コンパイル使用メモリ | 59,380 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-22 14:11:40 |
| 合計ジャッジ時間 | 7,782 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 TLE * 1 |
ソースコード
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main() {
string s;
cin >> s;
long long ans = 0;
for (int i = 0; i < s.size(); i++) {
if (s[i] != 'c') {
continue;
}
long long nw = count(s.begin() + i, s.end(), 'w');
ans += nw * (nw - 1) / 2;
}
cout << ans << endl;
return 0;
}