Submission #1382905
Source Code Expand
#include <bits/stdc++.h> using namespace std; #define forn(i, s, f) for(int i = (s); i <= (f); ++i) #define for1(i, f, s) for(int i = (f); i >= (s); --i) #define fora(i, x) for (auto i : x) #define show(x) cout << #x << " = " << x << " "; #define skip continue; #define pb push_back #define _1 first #define _2 second typedef long long ll; const int N3 = 1e3 + 5; const int N4 = 1e4 + 5; const int N5 = 1e5 + 5; const int N6 = 1e6 + 5; const int N7 = 1e7 + 5; const int N8 = 1e8 + 5; const int N9 = 1e9 + 5; const int mod = N9 + 2; #define int ll int a, b; main() { cin >> a >> b; if (a * -1 == b) { cout << 1; return 0; } ans = abs(abs(a) - abs(b)); if (a > 0 && b > 0 && a > b) cout << ans + 2; if (a > 0 && b > 0 && a < b) cout << ans; if (a < 0 && b < 0 && a > b) cout << ans + 2; if (a < 0 && b < 0 && a < b) cout << ans; if (a > 0 && b < 0) cout << ans + 1; if (a < 0 && b > 0) cout << ans + 1; }
Submission Info
Submission Time | |
---|---|
Task | A - Simple Calculator |
User | Bruteforcer_ |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1068 Byte |
Status | CE |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:37:5: error: ‘ans’ was not declared in this scope ans = abs(abs(a) - abs(b)); ^