結果
| 問題 |
No.78 クジ付きアイスバー
|
| コンテスト | |
| ユーザー |
notetonous
|
| 提出日時 | 2016-04-29 10:48:00 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
TLE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 396 bytes |
| コンパイル時間 | 492 ms |
| コンパイル使用メモリ | 21,120 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-06 19:14:30 |
| 合計ジャッジ時間 | 65,307 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 34 TLE * 1 |
コンパイルメッセージ
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);
| ^~~~~~~~~~~~~
ソースコード
#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;
}
notetonous