Submission #1042121
Source Code Expand
#include <iostream> #include <string.h> using namespace std; #define pb push_back #define mp make_pair #define ll long long #define ull unsigned ll #define db double #define INF 0x3f3f3f3f #define MOD 1000000007 #define PII pair<int, int> ll a,b; int main() { scanf("%lld%lld",&a,&b); int rev=0; if (a>0) { if (b<=0) rev=1; else { if (b>=a) rev=0; else rev=2; } } else if (a==0) { if (b>=0) rev=0; else rev=1; } else { if (b>=0) rev=1; else { if (b<=a) rev=2; else rev=0; } } printf("%lld\n",abs(abs(a)-abs(b))+rev); }
Submission Info
Submission Time | |
---|---|
Task | A - Simple Calculator |
User | oos1111 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 595 Byte |
Status | WA |
Exec Time | 3 ms |
Memory | 256 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:19:25: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%lld%lld",&a,&b); ^
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 | 3 ms | 256 KB |
0_01.txt | AC | 3 ms | 256 KB |
0_02.txt | AC | 3 ms | 256 KB |
1_00.txt | AC | 2 ms | 256 KB |
1_01.txt | AC | 3 ms | 256 KB |
1_02.txt | AC | 3 ms | 256 KB |
1_03.txt | AC | 3 ms | 256 KB |
1_04.txt | WA | 2 ms | 256 KB |
1_05.txt | AC | 3 ms | 256 KB |
1_06.txt | AC | 3 ms | 256 KB |
1_07.txt | AC | 3 ms | 256 KB |
1_08.txt | AC | 3 ms | 256 KB |
1_09.txt | AC | 2 ms | 256 KB |
1_10.txt | AC | 2 ms | 256 KB |