結果
| 問題 | No.346 チワワ数え上げ問題 |
| コンテスト | |
| ユーザー |
くれちー
|
| 提出日時 | 2017-02-04 19:55:04 |
| 言語 | C90 (gcc 15.2.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 290 bytes |
| 記録 | |
| コンパイル時間 | 53 ms |
| コンパイル使用メモリ | 36,736 KB |
| 実行使用メモリ | 5,888 KB |
| 最終ジャッジ日時 | 2026-07-24 20:48:27 |
| 合計ジャッジ時間 | 1,932 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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;
}
くれちー