結果
問題 |
No.346 チワワ数え上げ問題
|
ユーザー |
![]() |
提出日時 | 2017-02-04 19:55:04 |
言語 | C90 (gcc 12.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 290 bytes |
コンパイル時間 | 220 ms |
コンパイル使用メモリ | 20,736 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-24 06:18:09 |
合計ジャッジ時間 | 1,304 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 14 WA * 9 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:7:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 7 | scanf("%s", s); | ^~~~~~~~~~~~~~
ソースコード
#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; }