Submission #1382795
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; int a, b; int main() { cin >> a >> b; if (a == b) { cout << 0; return 0; } if ((a > 0 && b > 0) || (a < 0 && b < 0)) { if (a < b) { cout << abs(a - b); return 0; } if (a > b) { cout << 2 + abs(abs(a) - abs(b)); return 0; } } else { cout << 1 + abs(abs(a) - abs(b)); return 0; } }
Submission Info
Submission Time | |
---|---|
Task | A - Simple Calculator |
User | Bruteforcer_ |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1043 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 | AC | 1 ms | 256 KB |
1_03.txt | AC | 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 |