Submission #2735746
Source Code Expand
#include<iostream> using namespace std; int main(){ string s; cin >> s; bool o = true; int ans = 0; for(int i = 0 ; i < n ; i++){ if(o && s[i] == 'I'){ ans++; o = false; }else if(!o && s[i] == 'O'){ ans++; o = true; } } cout << ans << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - IOI列車で行こう2 |
User | mhrb |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 324 Byte |
Status | CE |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:9:23: error: ‘n’ was not declared in this scope for(int i = 0 ; i < n ; i++){ ^