Submission #1473778
Source Code Expand
#include<functional> #include<algorithm> #include<iostream> #include<utility> #include<string> #include<vector> #include<cmath> #include<stack> #include<queue> #include<deque> #include<map> #define rep(i,n) for(int i=0;i<n;i++) #define loop(i,x,n) for(int i=x;i<n;i++) #define pb push_back #define pf push_front #define int long long using namespace std; const int INF=1000000007; int dx[4]={1,0,-1,0}; int dy[4]={0,1,0,-1}; signed main(){ int a,b; cin>>a>>b; int c=0; if(a==(-1)*b){ c++; cout<<c<<endl; return 0; } if(a<0&&b<0&&b<a){ c+=2+abs(a-b); cout<<c<<endl; }else if(a<0&&b<0&&a<b){ cout<<abs(a-b)<<endl; }else if(a<b&&0<a){ cout<<b-a<<endl; }else if(a<0&&0<b){ c+=1+abs(a-b); cout<<c<<endl; } return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - Simple Calculator |
User | fuu32 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 823 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 | WA | 1 ms | 256 KB |
1_06.txt | WA | 1 ms | 256 KB |
1_07.txt | WA | 1 ms | 256 KB |
1_08.txt | WA | 1 ms | 256 KB |
1_09.txt | WA | 1 ms | 256 KB |
1_10.txt | AC | 1 ms | 256 KB |