結果

問題 No.346 チワワ数え上げ問題
ユーザー prestopresto
提出日時 2016-02-27 20:53:37
言語 C90
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 317 bytes
コンパイル時間 601 ms
コンパイル使用メモリ 21,192 KB
実行使用メモリ 4,372 KB
最終ジャッジ日時 2023-10-24 18:38:40
合計ジャッジ時間 2,709 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 0 ms
4,348 KB
testcase_03 AC 0 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 0 ms
4,348 KB
testcase_07 AC 0 ms
4,348 KB
testcase_08 AC 0 ms
4,348 KB
testcase_09 AC 0 ms
4,348 KB
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 AC 1 ms
4,348 KB
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 AC 0 ms
4,348 KB
testcase_24 AC 0 ms
4,348 KB
testcase_25 AC 1 ms
4,348 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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);
      |   ^~~~~~~~~~~~~~

ソースコード

diff #

/* 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);
}
0