結果

問題 No.78 クジ付きアイスバー
ユーザー notetonousnotetonous
提出日時 2016-04-29 10:48:00
言語 C90
(gcc 11.4.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 396 bytes
コンパイル時間 684 ms
コンパイル使用メモリ 20,992 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-16 06:12:19
合計ジャッジ時間 65,327 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 0 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 0 ms
5,376 KB
testcase_05 AC 761 ms
5,376 KB
testcase_06 AC 1,969 ms
5,376 KB
testcase_07 AC 788 ms
5,376 KB
testcase_08 AC 1,282 ms
5,376 KB
testcase_09 AC 4,079 ms
5,376 KB
testcase_10 AC 2,097 ms
5,376 KB
testcase_11 AC 1,045 ms
5,376 KB
testcase_12 AC 3,488 ms
5,376 KB
testcase_13 AC 3,707 ms
5,376 KB
testcase_14 AC 3,828 ms
5,376 KB
testcase_15 AC 1,687 ms
5,376 KB
testcase_16 AC 2,622 ms
5,376 KB
testcase_17 AC 3,083 ms
5,376 KB
testcase_18 AC 3,139 ms
5,376 KB
testcase_19 AC 3,340 ms
5,376 KB
testcase_20 AC 3,525 ms
5,376 KB
testcase_21 AC 4,129 ms
5,376 KB
testcase_22 AC 3,717 ms
5,376 KB
testcase_23 AC 1 ms
5,376 KB
testcase_24 AC 0 ms
5,376 KB
testcase_25 AC 1 ms
5,376 KB
testcase_26 AC 0 ms
5,376 KB
testcase_27 AC 0 ms
5,376 KB
testcase_28 AC 0 ms
5,376 KB
testcase_29 AC 1 ms
5,376 KB
testcase_30 AC 1 ms
5,376 KB
testcase_31 AC 1 ms
5,376 KB
testcase_32 AC 1 ms
5,376 KB
testcase_33 AC 4 ms
5,376 KB
testcase_34 AC 858 ms
5,376 KB
testcase_35 AC 1,165 ms
5,376 KB
testcase_36 AC 3,321 ms
5,376 KB
testcase_37 AC 4,143 ms
5,376 KB
testcase_38 TLE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:8:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |   scanf("%d %d",&N,&K);
      |   ^~~~~~~~~~~~~~~~~~~~
main.c:9:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |   scanf("%s",s);
      |   ^~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <string.h>
int main(){
  int N,K;
  char s[50];
  int i=0,k=0,sum=0;
  int ans=0;
  scanf("%d %d",&N,&K);
  scanf("%s",s);
  while(k<K){
    i=0;
    while(i<N){
      if(sum==0)ans++;
      else sum--;
      if(s[i]=='0');
      else if(s[i]=='1')sum++;
      else sum=sum+2;
      k++;
      if(k>=K)break;
      i++;
    }
  }
 
  printf("%d\n",ans);
  return 0;
}
0