Submission #1043071
Source Code Expand
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.IO; using System.Text; public class Don { public Don() { } private Reader r = new Reader(); public void Solve() { var x = r.nextInt(); var y = r.nextInt(); if (x <= y) { if (x < 0 && y > 0) { if (x + y >= 0) { Console.WriteLine(x + y + 1); } else { Console.WriteLine(y - x); } } else { Console.WriteLine(y - x); } } else { // x > y if (x > 0 && y < 0) { if (x + y >= 0) { Console.WriteLine(x + y + 1); } else { Console.WriteLine(- x - y + 1); } } else { Console.WriteLine(x + y + 1); } } } public static void Main(string[] args) { new Don().Solve(); } } class Reader { string[] s; int i; char[] cs = new char[] { ' ' }; public Reader() { s = new string[0]; i = 0; } public string next() { if (i < s.Length) return s[i++]; var input = Console.ReadLine(); while (input == "") input = Console.ReadLine(); s = input.Split(cs, StringSplitOptions.RemoveEmptyEntries); i = 0; return next(); } public int nextInt() { return int.Parse(next()); } public long nextLong() { return long.Parse(next()); } public double nextDouble() { return double.Parse(next()); } }
Submission Info
Submission Time | |
---|---|
Task | A - Simple Calculator |
User | oyakodon |
Language | C# (Mono 4.6.2.0) |
Score | 0 |
Code Size | 1967 Byte |
Status | WA |
Exec Time | 20 ms |
Memory | 2776 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 | 20 ms | 2776 KB |
0_01.txt | AC | 19 ms | 2648 KB |
0_02.txt | WA | 19 ms | 2648 KB |
1_00.txt | AC | 19 ms | 2648 KB |
1_01.txt | AC | 19 ms | 2648 KB |
1_02.txt | WA | 19 ms | 2648 KB |
1_03.txt | AC | 19 ms | 2648 KB |
1_04.txt | AC | 19 ms | 2648 KB |
1_05.txt | WA | 19 ms | 2648 KB |
1_06.txt | AC | 19 ms | 2648 KB |
1_07.txt | AC | 19 ms | 2648 KB |
1_08.txt | AC | 19 ms | 2648 KB |
1_09.txt | WA | 19 ms | 2648 KB |
1_10.txt | AC | 19 ms | 2648 KB |