Submission #1041485


Source Code Expand

#include <algorithm>
#include <iostream>
#include <string>
#include <cstring>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <limits>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <iterator>
#include <queue>
#include <stack>
#include <vector>
#include <utility>

#define FOR(i,k,n) for(int (i) = (k); (i) < (n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define all(v) begin(v), end(v)
#define debug(x) cerr << #x << ": " << x << endl
#define debug2(x,y) cerr << #x << ": " << x << ", " << #y << ": " << y << endl

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<i_i, int> p_i;
typedef vector<int> vi;
typedef vector< vector<int> > vvi;
template<class T> using vv=vector< vector<T> >;
typedef deque<int> di;
typedef deque< deque<int> > ddi;


int main() {
    int x, y;
    cin >> x >> y;
    int out;
    if(y <= 0 && x <= 0) {
        out = 2 + abs(y-x);
    } else if (y <= 0) {
        out = 1 + abs(abs(y) - abs(x));
    } else {
        out = abs(y-x);
    }
    cout << out << endl;
	return 0;
}

Submission Info

Submission Time
Task A - Simple Calculator
User tottotetotem
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1314 Byte
Status WA
Exec Time 3 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 3
AC × 7
WA × 7
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 3 ms 256 KB
1_02.txt WA 2 ms 256 KB
1_03.txt AC 2 ms 256 KB
1_04.txt WA 2 ms 256 KB
1_05.txt WA 2 ms 256 KB
1_06.txt AC 2 ms 256 KB
1_07.txt AC 3 ms 256 KB
1_08.txt WA 2 ms 256 KB
1_09.txt WA 3 ms 256 KB
1_10.txt WA 2 ms 256 KB