結果
| 問題 | No.346 チワワ数え上げ問題 |
| コンテスト | |
| ユーザー |
くれちー
|
| 提出日時 | 2017-02-04 19:55:04 |
| 言語 | C90 (gcc 15.2.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 290 bytes |
| 記録 | |
| コンパイル時間 | 261 ms |
| コンパイル使用メモリ | 38,864 KB |
| 最終ジャッジ日時 | 2026-02-24 00:16:45 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 WA * 9 |
ソースコード
#include <stdio.h>
#include <string.h>
#define rrep(i, n) for (i = n; i >= 0; i--)
int main() {
static char s[100000];
scanf("%s", s);
int i, w = 0, ans = 0;
rrep(i, strlen(s)) {
if (s[i] == 'w') w++;
if (s[i] == 'c') ans += (w - 1) * w / 2;
}
printf("%d\n", ans);
return 0;
}
くれちー