Created
October 23, 2014 21:53
-
-
Save k0ksi/230c4f0c1c05d236e865 to your computer and use it in GitHub Desktop.
HalfSum
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
namespace Half_Sum | |
{ | |
class HalfSum | |
{ | |
public static void Main(string[] args) | |
{ | |
int n = int.Parse(Console.ReadLine()); | |
Console.WriteLine(); | |
int[] first = new int[n]; | |
for(int i = 0; i < n; i++) | |
{ | |
first[i] = int.Parse(Console.ReadLine()); | |
} | |
int[] second = new int[n]; | |
Console.WriteLine(); | |
for(int i = 0; i < n; i++) | |
{ | |
second[i] = int.Parse(Console.ReadLine()); | |
} | |
if(first.Sum() == second.Sum()) | |
{ | |
Console.WriteLine("Yes, sum=" + first.Sum()); | |
} | |
else | |
{ | |
Console.WriteLine("No, diff={0}", Math.Max(first.Sum(), second.Sum()) - Math.Min(first.Sum(), second.Sum())); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment