Skip to content

Instantly share code, notes, and snippets.

@k0ksi
Created October 23, 2014 21:53
Show Gist options
  • Save k0ksi/230c4f0c1c05d236e865 to your computer and use it in GitHub Desktop.
Save k0ksi/230c4f0c1c05d236e865 to your computer and use it in GitHub Desktop.
HalfSum
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