Submission #3246811
Source Code Expand
#include <iostream> #include <cstdlib> #include <vector> #include <algorithm> #include <math.h> using namespace std; int main() { long n, m; long answer; cin >> n >> m; if (n == 1 && m == 1){ answer = 1; } else if (n == 1 && m > 2){ answer = max(0, m-2); } else if (m == 1 && n > 2){ answer = max(0, n-2); } else if ((n == 2 && m > 2) || (m == 2 && n > 2)){ answer = 0; } else { // n >= 3 && m >= 3 answer = (n-2)*(m-2); } cout << answer << endl; }
Submission Info
Submission Time | |
---|---|
Task | C - Flip,Flip, and Flip...... |
User | Arthur_Lugh |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 575 Byte |
Status | CE |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:17:28: error: no matching function for call to ‘max(int, long int)’ answer = max(0, m-2); ^ In file included from /usr/include/c++/5/bits/char_traits.h:39:0, from /usr/include/c++/5/ios:40, from /usr/include/c++/5/ostream:38, from /usr/include/c++/5/iostream:39, from ./Main.cpp:1: /usr/include/c++/5/bits/stl_algobase.h:219:5: note: candidate: template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&) max(const _Tp& __a, const _Tp& __b) ^ /usr/include/c++/5/bits/stl_algobase.h:219:5: note: template argument deduction/substitution failed: ./Main.cpp:17:28: note: deduced conflicting types for parameter ‘const _Tp’ (‘int’ and ‘long int’) answer = max(0, m-2); ^ In file included from /usr/include/c++/5/bits/char_traits.h:39:0, from /usr/include/c++/5/ios:40, from...