Submission #1041373
Source Code Expand
#define yuki(x, y) for(int i = x; i < (y); ++i)
#define yukj(x, y) for(int j = x; j < (y); ++j)
#define yukii(x, y) for(int i = x; i <= (y); ++i)
#define yukji(x, y) for(int j = x; j <= (y); ++j)
#define yuk(x, y, z) for(int x = y; x < (z); ++x)
#define yui(x, y, z) for(int x = y; x >= (z); --x)
#define sclr(x) memset(x, 0, sizeof(x))
#define sclr1(x) memset(x, -1, sizeof(x))
#define scl(x, y) memset(x, y, sizeof(x))
#define ft first
#define sc second
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long lol;
int x, y;
int snow(int x) {return x < 0 ? -x : x;}
int main(int argc, char **argv)
{
scanf("%d%d", &x, &y);
if(x <= y)
{
if((lol)x*y >= 0) printf("%d\n", y-x);
else printf("%d\n", snow(snow(y)-snow(x))+1);
}
else
{
if((lol)x*y > 0) printf("%d\n", x-y+2);
else printf("%d\n", snow(snow(y)-snow(x))+1);
}
return 0;
}
Submission Info
Submission Time
2016-12-25 21:11:41+0900
Task
A - Simple Calculator
User
Yukimai
Language
C++14 (GCC 5.4.1)
Score
300
Code Size
958 Byte
Status
AC
Exec Time
1 ms
Memory
128 KB
Compile Error
./Main.cpp: In function ‘int main(int, char**)’:
./Main.cpp:21:23: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d", &x, &y);
^
Judge Result
Set Name
Sample
All
Score / Max Score
0 / 0
300 / 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
128 KB
0_01.txt
AC
1 ms
128 KB
0_02.txt
AC
1 ms
128 KB
1_00.txt
AC
1 ms
128 KB
1_01.txt
AC
1 ms
128 KB
1_02.txt
AC
1 ms
128 KB
1_03.txt
AC
1 ms
128 KB
1_04.txt
AC
1 ms
128 KB
1_05.txt
AC
1 ms
128 KB
1_06.txt
AC
1 ms
128 KB
1_07.txt
AC
1 ms
128 KB
1_08.txt
AC
1 ms
128 KB
1_09.txt
AC
1 ms
128 KB
1_10.txt
AC
1 ms
128 KB