Submission #37499339
Source Code Expand
#include <stdio.h>
#include <string.h>
int main(void){
char str[100001];
scanf("%s", str);
int len = strlen(str);
int cnt = 0;
for(int i = 0; i < len-1; i++){
if(str[i] == '0' && str[i+1] == '0'){
cnt++;
i++;
}
}
printf("%d\n", len - cnt);
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | C - Cash Register |
| User | Cebu |
| Language | C (GCC 9.2.1) |
| Score | 300 |
| Code Size | 293 Byte |
| Status | AC |
| Exec Time | 4 ms |
| Memory | 1820 KiB |
Compile Error
./Main.c: In function ‘main’:
./Main.c:6:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
6 | scanf("%s", str);
| ^~~~~~~~~~~~~~~~
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 300 / 300 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt |
| All | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00_sample_00.txt | AC | 4 ms | 1736 KiB |
| 00_sample_01.txt | AC | 1 ms | 1728 KiB |
| 00_sample_02.txt | AC | 1 ms | 1732 KiB |
| 01_random_03.txt | AC | 2 ms | 1820 KiB |
| 01_random_04.txt | AC | 2 ms | 1768 KiB |
| 01_random_05.txt | AC | 1 ms | 1728 KiB |
| 01_random_06.txt | AC | 1 ms | 1768 KiB |
| 01_random_07.txt | AC | 2 ms | 1736 KiB |
| 01_random_08.txt | AC | 1 ms | 1776 KiB |
| 01_random_09.txt | AC | 1 ms | 1724 KiB |
| 01_random_10.txt | AC | 1 ms | 1712 KiB |
| 01_random_11.txt | AC | 1 ms | 1712 KiB |
| 01_random_12.txt | AC | 1 ms | 1688 KiB |
| 01_random_13.txt | AC | 1 ms | 1624 KiB |
| 01_random_14.txt | AC | 2 ms | 1772 KiB |