結果
問題 |
No.346 チワワ数え上げ問題
|
ユーザー |
![]() |
提出日時 | 2016-02-27 20:53:37 |
言語 | C90 (gcc 12.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 317 bytes |
コンパイル時間 | 373 ms |
コンパイル使用メモリ | 21,120 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-24 11:47:45 |
合計ジャッジ時間 | 2,801 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 11 RE * 12 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:11:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | scanf("%s", s); | ^~~~~~~~~~~~~~
ソースコード
/* yuki346.c */ #include <stdio.h> #include <string.h> int main(){ char s[9999] = {'\0'}; int i = 0; int w = 0; int sum = 0; scanf("%s", s); for(i = strlen(s) - 1; i >= 0; i--){ if(s[i] == 'w'){ w++; } if(s[i] == 'c'){ sum += w * (w - 1) / 2; } } printf("%d\n", sum); }