Submission #1382907
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, ans; 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 | 1073 Byte |
Status | WA |
Exec Time | 1 ms |
Memory | 256 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 300 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 0_00.txt, 0_01.txt, 0_02.txt |
All | 0_00.txt, 0_01.txt, 0_02.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_00.txt | AC | 1 ms | 256 KB |
0_01.txt | AC | 1 ms | 256 KB |
0_02.txt | AC | 1 ms | 256 KB |
1_00.txt | AC | 1 ms | 256 KB |
1_01.txt | WA | 1 ms | 256 KB |
1_02.txt | WA | 1 ms | 256 KB |
1_03.txt | WA | 1 ms | 256 KB |
1_04.txt | WA | 1 ms | 256 KB |
1_05.txt | AC | 1 ms | 256 KB |
1_06.txt | AC | 1 ms | 256 KB |
1_07.txt | AC | 1 ms | 256 KB |
1_08.txt | AC | 1 ms | 256 KB |
1_09.txt | AC | 1 ms | 256 KB |
1_10.txt | AC | 1 ms | 256 KB |