Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //// Loops - Homework - Problem 18
- namespace Pr_18_HW
- {
- using System;
- public class MainClass
- {
- public static void Main()
- {
- int n = int.Parse(Console.ReadLine());
- int maxDifference = 0;
- var lastCouple = int.Parse(Console.ReadLine()) +
- int.Parse(Console.ReadLine());
- for (int i = 1; i < n; i++)
- {
- var currentCouple = int.Parse(Console.ReadLine()) +
- int.Parse(Console.ReadLine());
- var diffence = currentCouple - lastCouple;
- var currentDifference = Math.Abs(diffence);
- if (currentDifference > maxDifference)
- {
- maxDifference = currentDifference;
- }
- lastCouple = currentCouple;
- }
- if (maxDifference > 0)
- {
- Console.WriteLine("No, maxdiff={0}", maxDifference);
- }
- else
- {
- Console.WriteLine($"Yes, value={lastCouple}");
- }
- }
- }
- }
- //// Basic Exam 17.07 - Problem 5 - Diamond
- namespace Pr05_Diamond_17_Jul
- {
- using System;
- public class MainClass
- {
- public static void Main()
- {
- int n = int.Parse(Console.ReadLine());
- string topRow = new string('.', n) + new string('*', 3*n) + new string('.', n);
- Console.WriteLine(topRow);
- ////
- for (int i = 0; i < n - 1; i++)
- {
- var outerDots = new string('.', n - 1 - i);
- var innerDots = new string('.', 3*n + i*2);
- var upperRow = outerDots + "*" + innerDots + "*" + outerDots;
- Console.WriteLine(upperRow);
- }
- ////
- string middleRow = new string('*', 5*n);
- Console.WriteLine(middleRow);
- ////
- for (int i = 0; i < 2*n; i++)
- {
- var outerDots = new string('.', 1 + i);
- var innerDots = new string('.', 5*n - 4 - 2*i);
- var lowerRow = outerDots + "*" + innerDots + "*" + outerDots;
- Console.WriteLine(lowerRow);
- }
- ////
- string bottomRow = new string('.', 2*n + 1) + new string('*', n - 2) + new string('.', 2 * n + 1);
- Console.WriteLine(bottomRow);
- }
- }
- }
Add Comment
Please, Sign In to add comment