Submission #1041118
Source Code Expand
#include <iostream> #include <vector> #include <map> #include <set> #include <queue> #include <algorithm> #include <iomanip> #include <cassert> using namespace std; #define GET_ARG(a,b,c,F,...) F #define REP3(i,s,e) for (i = s; i <= e; i++) #define REP2(i,n) REP3 (i,0,(int)(n)-1) #define REP(...) GET_ARG (__VA_ARGS__,REP3,REP2) (__VA_ARGS__) #define RREP3(i,s,e) for (i = s; i >= e; i--) #define RREP2(i,n) RREP3 (i,(int)(n)-1,0) #define RREP(...) GET_ARG (__VA_ARGS__,RREP3,RREP2) (__VA_ARGS__) #define DEBUG(x) cerr << #x ": " << x << endl int main(void) { int a, b; cin >> a >> b; if (a <= b) cout << b - a << endl; else if (a >= 0 && b >= 0 || a < 0 && b < 0) cout << a - b + 2 << endl; else cout << abs(abs(a)-abs(b)) + 1 << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - Simple Calculator |
User | h_noson |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 803 Byte |
Status | WA |
Exec Time | 2 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 | 2 ms | 256 KB |
0_01.txt | AC | 2 ms | 256 KB |
0_02.txt | AC | 2 ms | 256 KB |
1_00.txt | WA | 2 ms | 256 KB |
1_01.txt | AC | 2 ms | 256 KB |
1_02.txt | AC | 2 ms | 256 KB |
1_03.txt | WA | 2 ms | 256 KB |
1_04.txt | AC | 2 ms | 256 KB |
1_05.txt | AC | 2 ms | 256 KB |
1_06.txt | AC | 2 ms | 256 KB |
1_07.txt | AC | 2 ms | 256 KB |
1_08.txt | WA | 2 ms | 256 KB |
1_09.txt | WA | 2 ms | 256 KB |
1_10.txt | AC | 2 ms | 256 KB |