提出 #61146830
ソースコード 拡げる
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
char S[500111];
int L;
int main()
{
scanf("%s", S);
L = strlen(S);
int ptr = 0;
int ans = 0;
while(ptr < L)
{
if (S[ptr] != '0')
{
ptr++;
ans++;
}
else if (ptr + 1 < L && S[ptr + 1] == '0')
{
ptr += 2;
ans++;
}
else
{
ptr++;
ans++;
}
}
printf("%d\n", ans);
return 0;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | B - Calculator |
| ユーザ | Enchom |
| 言語 | C++ 20 (gcc 12.2) |
| 得点 | 200 |
| コード長 | 572 Byte |
| 結果 | AC |
| 実行時間 | 1 ms |
| メモリ | 3872 KiB |
コンパイルエラー
Main.cpp: In function ‘int main()’:
Main.cpp:11:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
11 | scanf("%s", S);
| ~~~~~^~~~~~~~~
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 200 / 200 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | sample_01.txt, sample_02.txt, sample_03.txt |
| All | sample_01.txt, sample_02.txt, sample_03.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| sample_01.txt | AC | 1 ms | 3812 KiB |
| sample_02.txt | AC | 1 ms | 3764 KiB |
| sample_03.txt | AC | 1 ms | 3624 KiB |
| test_01.txt | AC | 1 ms | 3612 KiB |
| test_02.txt | AC | 1 ms | 3624 KiB |
| test_03.txt | AC | 1 ms | 3872 KiB |
| test_04.txt | AC | 1 ms | 3680 KiB |
| test_05.txt | AC | 1 ms | 3620 KiB |
| test_06.txt | AC | 1 ms | 3764 KiB |
| test_07.txt | AC | 1 ms | 3764 KiB |
| test_08.txt | AC | 1 ms | 3608 KiB |
| test_09.txt | AC | 1 ms | 3624 KiB |
| test_10.txt | AC | 1 ms | 3752 KiB |
| test_11.txt | AC | 1 ms | 3612 KiB |
| test_12.txt | AC | 1 ms | 3624 KiB |
| test_13.txt | AC | 1 ms | 3760 KiB |
| test_14.txt | AC | 1 ms | 3576 KiB |
| test_15.txt | AC | 1 ms | 3612 KiB |
| test_16.txt | AC | 1 ms | 3620 KiB |