Submission #1180769


Source Code Expand

#include<bits/stdc++.h>
const long long INF = INT_MAX / 2;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n+1)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
#define ll long long int
using namespace std;
ll ans = 0, sum = 0, n, k, cnt = 0, w, h;
string s;
vector<ll> v;
vector<ll> v1;
vector < pair<ll, ll > > vp;
vector<vector<ll> > vv(50, vector<ll>(50, INF));
vector<string> vs;
vector<char> vc;
set<ll> st;
map<char, ll> mp;

/*--------------------template--------------------*/

int main()
{
	cin >> n >> k;
	h = abs(n);
	w = abs(k);
	if(n<k)
	{
		if (h < 0) ans++;
		if (w < 0) ans++;
		cout << k - n + ans << endl;
	}else if(n==k)
	{
		cout << 1 << endl;
	}else
	{
		if (h > 0) ans++;
		if (w > 0) ans++;
		cout << n - k + ans << endl;
	}
}

Submission Info

Submission Time
Task A - Simple Calculator
User tettchan
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1025 Byte
Status WA
Exec Time 6 ms
Memory 764 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 2
WA × 1
AC × 8
WA × 6
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 6 ms 764 KB
0_01.txt WA 1 ms 256 KB
0_02.txt AC 1 ms 256 KB
1_00.txt WA 1 ms 256 KB
1_01.txt AC 1 ms 256 KB
1_02.txt AC 1 ms 256 KB
1_03.txt AC 1 ms 256 KB
1_04.txt AC 1 ms 256 KB
1_05.txt AC 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