結果
| 問題 | No.346 チワワ数え上げ問題 |
| コンテスト | |
| ユーザー |
rodea
|
| 提出日時 | 2018-02-20 17:58:29 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 394 bytes |
| 記録 | |
| コンパイル時間 | 475 ms |
| コンパイル使用メモリ | 64,256 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-07-20 05:02:47 |
| 合計ジャッジ時間 | 5,166 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | AC * 13 WA * 7 TLE * 1 -- * 2 |
ソースコード
#include<iostream>
#include<string>
using namespace std;
int main()
{
string s;
cin >> s;
int count = 0, ans = 0;
for (int i = 0; i < s.length(); i++)
{
if (s[i] == 'c')
{
for (int j = i + 1; j < s.length(); j++)
{
if (s[j] == 'w')
{
count++;
}
}
if (count > 1)
{
ans += count * (count - 1) / 2;
}
count = 0;
}
}
cout << ans << endl;
}
rodea