Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Half Sum
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { //Your code goes here int num = Convert.ToInt32(Console.ReadLine()); int[] sequence1 = new int[num]; int[] sequence2 = new int[num]; for (int i = 0; i<num; i++) { sequence1[i] = Convert.ToInt32(Console.ReadLine()); } for (int i = 0; i<num; i++) { sequence2[i] = Convert.ToInt32(Console.ReadLine()); } //calculates sums int result1 = 0; int result2 = 0; foreach (int number in sequence1) { //Console.WriteLine(number); result1 = result1 + number; //Console.WriteLine(result1); } //Console.WriteLine(result1); foreach (int number in sequence2) { // Console.WriteLine(number); result2 = result2 + number; } //Console.WriteLine(result2); if (result1 == result2) { Console.WriteLine("Yes, sum={0}", result1); } else { Console.WriteLine("No, diff={0}", Math.Abs(result1 - result2)); } } } }
run
|
edit
|
history
|
help
0
Dotnet Q-3
5
Switch
Problem: binary
Pentagon`s area
ARM
Problem: binary
LINQ - Inner Join
Reed Solomon Demo
sdfnmj,k, mnfdc