Submission #1042116


Source Code Expand

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Numerics;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            BigInteger[] input = Console.ReadLine().Split(' ').Select(v => BigInteger.Parse(v)).ToArray();
            BigInteger x = input[0];
            BigInteger y = input[1];
            BigInteger ans = 0;

            if (x >= 0 && y >= 0 )
            {
                if (BigInteger.Abs(x) <= BigInteger.Abs(y))
                    ans += BigInteger.Abs(BigInteger.Abs(y) - BigInteger.Abs(x)); // 9 10
                else
                    ans += BigInteger.Abs(BigInteger.Abs(y) - BigInteger.Abs(x)) + 2; // 10 9
            }
            else if (x >= 0 && y < 0)
            {
                if (BigInteger.Abs(x) <= BigInteger.Abs(y))
                    ans += BigInteger.Abs(BigInteger.Abs(y) - BigInteger.Abs(x)) + 1;// 9 -10
                else
                    ans += BigInteger.Abs(BigInteger.Abs(y) - BigInteger.Abs(x)) + 1; // 10 -9
            }
            else if (x < 0 && y >= 0)
            {
                if (BigInteger.Abs(x) <= BigInteger.Abs(y))
                    ans += BigInteger.Abs(BigInteger.Abs(y) - BigInteger.Abs(x)) + 1;// -9 10
                else
                    ans += BigInteger.Abs(BigInteger.Abs(y) - BigInteger.Abs(x)) + 1; // -10 9
            }
            else 
            {
                if (BigInteger.Abs(x) <= BigInteger.Abs(y))
                    ans += BigInteger.Abs(BigInteger.Abs(y) - BigInteger.Abs(x)) + 2;// -9 -10
                else
                    ans += BigInteger.Abs(BigInteger.Abs(y) - BigInteger.Abs(x)); // -10 -9
            }

            Console.WriteLine(ans);
#if DEBUG
            Console.ReadKey();
#endif
        }
    }
}

Submission Info

Submission Time
Task A - Simple Calculator
User arushiro
Language C# (Mono 4.6.2.0)
Score 0
Code Size 1913 Byte
Status WA
Exec Time 30 ms
Memory 3416 KB

Judge Result

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