Submission #5035666
Source Code Expand
#include "bits/stdc++.h" using namespace std; int main() { string S; bool IO = true; int count = 0; cin >> S; for (int i = 0; i < S.size(); i++) { if (S[i] == 'I' && IO) { IO = !IO; count++; } if (S[i] == 'O' && !IO) { IO = !IO; count++; } } if (count % 2 == 0) count--; cout << count << end;; }
Submission Info
Submission Time | |
---|---|
Task | A - IOI列車で行こう2 |
User | yuma220284 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 344 Byte |
Status | CE |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:20:16: error: no match for ‘operator<<’ (operand types are ‘std::basic_ostream<char>’ and ‘<unresolved overloaded function type>’) cout << count << end;; ^ In file included from /usr/include/c++/5/istream:39:0, from /usr/include/c++/5/sstream:38, from /usr/include/c++/5/complex:45, from /usr/include/c++/5/ccomplex:38, from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52, from ./Main.cpp:1: /usr/include/c++/5/ostream:108:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ostream<_CharT, _Traits>::__ostream_type& (*)(std::basic_ostream<_CharT, _Traits>::__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>] operator<<(__ostream_type& (*__pf)(__ostream_type&)) ^ /usr/...