Submission #1043074
Source Code Expand
#include<iostream> #include<vector> #include<algorithm> #include<map> using namespace std; int main(void) { int x, y; int ans; cin >> x >> y; if (x > 0) { if (y > x) ans = y - x; else if (y == x) ans = 0; else if (y > 0) ans = 2 + x - y; else ans = 1 - y - x; } else if (x == 0) { if (y >= 0) ans = y; else ans = 1 - y; } else { if (y >= -x) ans = 1 + y + x; else if (y > 0) ans = 1 - x - y; else if (y == 0) ans = -x; else if (y > x)ans = y - x; else ans = 2 + x - y; } cout << ans << endl; system("pause"); return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - Simple Calculator |
User | harmokey |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 593 Byte |
Status | WA |
Exec Time | 4 ms |
Memory | 504 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:33:17: warning: ignoring return value of ‘int system(const char*)’, declared with attribute warn_unused_result [-Wunused-result] system("pause"); ^
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 | 4 ms | 504 KB |
0_01.txt | AC | 4 ms | 504 KB |
0_02.txt | AC | 4 ms | 504 KB |
1_00.txt | AC | 4 ms | 504 KB |
1_01.txt | AC | 4 ms | 500 KB |
1_02.txt | AC | 4 ms | 504 KB |
1_03.txt | WA | 4 ms | 504 KB |
1_04.txt | AC | 4 ms | 504 KB |
1_05.txt | AC | 4 ms | 504 KB |
1_06.txt | AC | 4 ms | 504 KB |
1_07.txt | WA | 4 ms | 504 KB |
1_08.txt | AC | 4 ms | 504 KB |
1_09.txt | AC | 4 ms | 504 KB |
1_10.txt | AC | 4 ms | 504 KB |