SHOW:
|
|
- or go back to the newest paste.
| 1 | //// Loops - Homework - Problem 18 | |
| 2 | namespace Pr_18_HW | |
| 3 | {
| |
| 4 | using System; | |
| 5 | public class MainClass | |
| 6 | {
| |
| 7 | public static void Main() | |
| 8 | {
| |
| 9 | int n = int.Parse(Console.ReadLine()); | |
| 10 | int maxDifference = 0; | |
| 11 | ||
| 12 | var lastCouple = int.Parse(Console.ReadLine()) + | |
| 13 | int.Parse(Console.ReadLine()); | |
| 14 | ||
| 15 | for (int i = 1; i < n; i++) | |
| 16 | {
| |
| 17 | var currentCouple = int.Parse(Console.ReadLine()) + | |
| 18 | int.Parse(Console.ReadLine()); | |
| 19 | var diffence = currentCouple - lastCouple; | |
| 20 | var currentDifference = Math.Abs(diffence); | |
| 21 | if (currentDifference > maxDifference) | |
| 22 | {
| |
| 23 | maxDifference = currentDifference; | |
| 24 | } | |
| 25 | ||
| 26 | lastCouple = currentCouple; | |
| 27 | } | |
| 28 | ||
| 29 | if (maxDifference > 0) | |
| 30 | {
| |
| 31 | Console.WriteLine("No, maxdiff={0}", maxDifference);
| |
| 32 | } | |
| 33 | else | |
| 34 | {
| |
| 35 | Console.WriteLine($"Yes, value={lastCouple}");
| |
| 36 | } | |
| 37 | } | |
| 38 | } | |
| 39 | } | |
| 40 | ||
| 41 | //// Basic Exam 17.07 - Problem 5 - Diamond | |
| 42 | namespace Pr05_Diamond_17_Jul | |
| 43 | {
| |
| 44 | using System; | |
| 45 | ||
| 46 | public class MainClass | |
| 47 | {
| |
| 48 | public static void Main() | |
| 49 | {
| |
| 50 | int n = int.Parse(Console.ReadLine()); | |
| 51 | string topRow = new string('.', n) + new string('*', 3*n) + new string('.', n);
| |
| 52 | Console.WriteLine(topRow); | |
| 53 | //// | |
| 54 | for (int i = 0; i < n - 1; i++) | |
| 55 | {
| |
| 56 | var outerDots = new string('.', n - 1 - i);
| |
| 57 | var innerDots = new string('.', 3*n + i*2);
| |
| 58 | var upperRow = outerDots + "*" + innerDots + "*" + outerDots; | |
| 59 | Console.WriteLine(upperRow); | |
| 60 | } | |
| 61 | //// | |
| 62 | string middleRow = new string('*', 5*n);
| |
| 63 | Console.WriteLine(middleRow); | |
| 64 | //// | |
| 65 | for (int i = 0; i < 2*n; i++) | |
| 66 | {
| |
| 67 | var outerDots = new string('.', 1 + i);
| |
| 68 | var innerDots = new string('.', 5*n - 4 - 2*i);
| |
| 69 | var lowerRow = outerDots + "*" + innerDots + "*" + outerDots; | |
| 70 | Console.WriteLine(lowerRow); | |
| 71 | } | |
| 72 | //// | |
| 73 | string bottomRow = new string('.', 2*n + 1) + new string('*', n - 2) + new string('.', 2 * n + 1);
| |
| 74 | Console.WriteLine(bottomRow); | |
| 75 | } | |
| 76 | } | |
| 77 | } |