Submission #3125826
Source Code Expand
#include<bits/stdc++.h> using namespace std; string a,k; int not_; int main() { while(cin>>a) { if(a=="not")not_++; else k=a; } if(k=="") { while(not_--)cout<<"not "; cout<<endl; } else { if(k%2==0)cout<<k<<endl; else cout<<"not "<<k<<endl; } }
Submission Info
Submission Time | |
---|---|
Task | A - 二重否定除去法則 |
User | RioBlu |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 289 Byte |
Status | CE |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:19:7: error: no match for ‘operator%’ (operand types are ‘std::string {aka std::basic_string<char>}’ and ‘int’) if(k%2==0)cout<<k<<endl; ^ In file included from /usr/include/c++/5/valarray:587:0, from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:94, from ./Main.cpp:1: /usr/include/c++/5/bits/valarray_after.h:406:5: note: candidate: template<class _Dom1, class _Dom2> std::_Expr<std::_BinClos<std::__modulus, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__modulus, typename _Dom1::value_type>::result_type> std::operator%(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const std::_Expr<_Dom2, typename _Dom2::value_type>&) _DEFINE_EXPR_BINARY_OPERATOR(%, __modulus) ^ /usr/include/c++/5/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: ./Main.cpp:19:8: note: ‘std::string {aka std::basic_string<char>}’ is not derived from ‘const std::_Expr<_Dom1, t...