Submission #61150328
Source Code Expand
#ifndef ATCODER // AtCoder 環境でない場合はデバッグモードを有効にする. コンパイルにすごく時間がかかる!
#define _GLIBCXX_DEBUG // out of rangeを検出してくれる。#include<bits/stdc++.h>の前に記述する必要あり
#endif
#include<bits/stdc++.h>
using namespace std;
struct IOSetup {
IOSetup() {
// 実行が高速化するコード
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
// 小数点以下10桁まで(四捨五入)
cout << fixed << setprecision(10);
}
} iosetup;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep2(i, a, b) for (int i = a; i < b; i++)
#define rrep2(i, b, a) for (int i = b; i > a; i--)
#define rep3(i, a, b, d) for (int i = a; i < b; i+=d)
#define rrep3(i, b, a, d) for (int i = b; i > a; i-=d)
#define between(x, a, b) (((a) <= (x)) && ((x) < (b)))
int main() {
string s; cin >> s;
bool flag = false;
int cnt = 0;
rep(i, s.size()) {
if (flag) {
flag = false;
continue;
}
if (i < s.size() - 1 && (s[i] == '0' && s[i + 1] == '0')) {
flag = true;
}
cnt++;
}
cout << cnt << endl;
}
Submission Info
| Submission Time | |
|---|---|
| Task | B - Calculator |
| User | kazuki00 |
| Language | C++ 23 (gcc 12.2) |
| Score | 200 |
| Code Size | 1249 Byte |
| Status | AC |
| Exec Time | 1 ms |
| Memory | 3600 KiB |
Compile Error
Main.cpp: In function ‘int main()’:
Main.cpp:15:37: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
15 | #define rep(i, n) for (int i = 0; i < n; i++)
| ^
Main.cpp:26:5: note: in expansion of macro ‘rep’
26 | rep(i, s.size()) {
| ^~~
Main.cpp:31:15: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
31 | if (i < s.size() - 1 && (s[i] == '0' && s[i + 1] == '0')) {
| ~~^~~~~~~~~~~~~~
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 200 / 200 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| 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 |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| sample_01.txt | AC | 1 ms | 3412 KiB |
| sample_02.txt | AC | 1 ms | 3468 KiB |
| sample_03.txt | AC | 1 ms | 3404 KiB |
| test_01.txt | AC | 1 ms | 3420 KiB |
| test_02.txt | AC | 1 ms | 3412 KiB |
| test_03.txt | AC | 1 ms | 3420 KiB |
| test_04.txt | AC | 1 ms | 3420 KiB |
| test_05.txt | AC | 1 ms | 3444 KiB |
| test_06.txt | AC | 1 ms | 3428 KiB |
| test_07.txt | AC | 1 ms | 3444 KiB |
| test_08.txt | AC | 1 ms | 3416 KiB |
| test_09.txt | AC | 1 ms | 3464 KiB |
| test_10.txt | AC | 1 ms | 3416 KiB |
| test_11.txt | AC | 1 ms | 3436 KiB |
| test_12.txt | AC | 1 ms | 3476 KiB |
| test_13.txt | AC | 1 ms | 3600 KiB |
| test_14.txt | AC | 1 ms | 3468 KiB |
| test_15.txt | AC | 1 ms | 3488 KiB |
| test_16.txt | AC | 1 ms | 3488 KiB |