Submission #874046

#TimeUsernameProblemLanguageResultExecution timeMemory
874046vjudge1Lamps (JOI19_lamps)C++17
4 / 100
3 ms1528 KiB
#include <bits/stdc++.h>
#define file_io freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define fast_io ios::sync_with_stdio(false);cin.tie(0);
#define what(x) cerr << #x << " is " << x << '\n';
#define kill(x) {cout << x << '\n'; continue;}
#define all(x) (x).begin(), (x).end()
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define ll long long
#define MP make_pair
#define F first
#define S second
const ll inf = 1e18, mod = 1e9 + 7, delta = 1e9 + 9, SQ = 450, P = 6065621; //998244353

using namespace std;

const ll N = 5e3 + 10, LG = 20;

int main() {
  fast_io;
  string s;
  int n;
  cin >> n >> s;
  cin >> s;
  int ans = 0;
  for (int i = 0; i < s.size(); i++)
    ans += (s[i] == '1' && (!i || s[i - 1] == '0'));
  cout << ans << '\n';
  return 0; 
}

Compilation message (stderr)

lamp.cpp: In function 'int main()':
lamp.cpp:27:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |   for (int i = 0; i < s.size(); i++)
      |                   ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...