SHOW:
|
|
- or go back to the newest paste.
1 | using System; | |
2 | namespace EqualPairs | |
3 | { | |
4 | class EqualPairs | |
5 | { | |
6 | static void Main(string[] args) | |
7 | { | |
8 | - | int n = int.Parse(Console.ReadLine()); |
8 | + | int n = Integer.parseInt(console.nextLine()); |
9 | int currSum = 0; | |
10 | int prevSum = 0; | |
11 | int diff = 0; | |
12 | int maxDiff = 0; | |
13 | for (int i = 0; i < n; i++) | |
14 | { | |
15 | prevSum = currSum; | |
16 | currSum = 0; | |
17 | - | currSum += int.Parse(Console.ReadLine()); |
17 | + | currSum += Integer.parseInt(console.nextLine()); |
18 | - | currSum += int.Parse(Console.ReadLine()); |
18 | + | currSum += Integer.parseInt(console.nextLine()); |
19 | if (i != 0) | |
20 | { | |
21 | diff = Math.Abs(currSum - prevSum); | |
22 | if (diff != 0 && diff > maxDiff) | |
23 | { | |
24 | maxDiff = diff; | |
25 | } | |
26 | } | |
27 | ||
28 | } | |
29 | if (prevSum == currSum || n == 1) | |
30 | { | |
31 | - | Console.WriteLine("Yes, value={0}", currSum); |
31 | + | System.out.println("Yes, value={0}", currSum); |
32 | } | |
33 | else | |
34 | { | |
35 | - | Console.WriteLine("No, maxdiff={0}", maxDiff); |
35 | + | System.out.println("No, maxdiff={0}", maxDiff); |
36 | } | |
37 | } | |
38 | } | |
39 | } |