結果
| 問題 | No.346 チワワ数え上げ問題 |
| コンテスト | |
| ユーザー |
a
|
| 提出日時 | 2016-07-09 03:49:17 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 327 bytes |
| 記録 | |
| コンパイル時間 | 127 ms |
| コンパイル使用メモリ | 40,192 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-04-30 16:55:37 |
| 合計ジャッジ時間 | 1,156 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 WA * 2 |
ソースコード
#include <cstdio>
#include <cstring>
using namespace std;
char s[111111];
int main(void) {
int w = 0;
scanf("%s", s);
int l = strlen(s);
long long res = 0;
for (int i = l-1; i >= 0; i--) {
if (s[i] == 'w') w += 1;
if (s[i] == 'c') {
res += w*(w-1)/2;
}
}
printf("%lld\n", res);
return 0;
}
a