aleukhin c384e1f9be 1st com | 9 kuukautta sitten | |
---|---|---|
ConsoleApp1 | 9 kuukautta sitten | |
.gitignore.txt | 9 kuukautta sitten | |
readme.md | 9 kuukautta sitten |
ВРМЕНА ГОДА
Console.WriteLine("Введите номер месяца: ");
string c = Console.ReadLine();
int a = Convert.ToInt32(c);
if (a == 12 || a == 1 || a == 2)
{
Console.WriteLine("Winter");
}
if (a >= 3 & a <= 5)
{
Console.WriteLine("Spring");
}
if (a >= 6 & a <= 8)
{
Console.WriteLine("Summer");
}
if (a >= 9 & a <= 11)
{
Console.WriteLine("Autumn");
}
if (a > 12)
{
Console.WriteLine("Error");
}
БУДИЛЬНИК
Console.WriteLine("Введите час, когда исследователь лег, и час,на который установил будильник:");
var grx = Console.ReadLine();
int a, b;
a = int.Parse(grx.Split()[0]);
b = int.Parse(grx.Split()[1]);
if (1 <= a & a<=12 & b <= 12 & a != b)
{
if (a < b)
{
Console.WriteLine(b-a);
}
if (a > b )
{
Console.WriteLine((a-b)+2);
}
}
else
{
Console.WriteLine("error");
}
АРБУЗЫ
string[] inputLines = File.ReadAllLines("INPUT.TXT");
int N = int.Parse(inputLines[0]);
int[] weights = Array.ConvertAll(inputLines[1].Split(), int.Parse);
int lightest = weights.Min();
int heaviest = weights.Max();
using (StreamWriter writer = new StreamWriter("OUTPUT.TXT"))
{
writer.WriteLine(lightest + " " + heaviest);
}
художник
int w, h, n;
int[,] canvas;
using (StreamReader reader = new StreamReader("INPUT.TXT"))
{
string[] wh = reader.ReadLine().Split();
w = int.Parse(wh[0]);
h = int.Parse(wh[1]);
n = int.Parse(reader.ReadLine());
canvas = new int[w, h];
for (int i = 0; i < w; i++)
{
for (int j = 0; j < h; j++)
{
canvas[i, j] = 0;
}
}
for (int i = 0; i < n; i++)
{
string[] rectangle = reader.ReadLine().Split();
int x1 = int.Parse(rectangle[0]);
int y1 = int.Parse(rectangle[1]);
int x2 = int.Parse(rectangle[2]);
int y2 = int.Parse(rectangle[3]);
for (int x = x1; x < x2; x++)
{
for (int y = y1; y < y2; y++)
{
canvas[x, y] = 1;
}
}
}
}
int unpaintedArea = 0;
for (int i = 0; i < w; i++)
{
for (int j = 0; j < h; j++)
{
if (canvas[i, j] == 0)
{
unpaintedArea++;
}
}
}
using (StreamWriter writer = new StreamWriter("OUTPUT.TXT"))
{
writer.WriteLine(unpaintedArea);
}
ЦВЕТ0ЧКИ
using System;
using System.IO;
class Program
{
static void Main()
{
string inputPath = "INPUT.TXT";
string outputPath = "OUTPUT.TXT";
int K = 0;
using (StreamReader reader = new StreamReader(inputPath))
{
K = int.Parse(reader.ReadLine());
}
char[] flowers = { 'G', 'C', 'V' };
for (int i = 0; i < K; i++)
{
char temp = flowers[2];
flowers[2] = flowers[1];
flowers[1] = flowers[0];
flowers[0] = temp;
}
using (StreamWriter writer = new StreamWriter(outputPath))
{
foreach (char flower in flowers)
{
writer.Write(flower);
writer.Write(' ');
}
}
}
}
ТОРТ
string input = File.ReadAllText("INPUT.TXT");
int N = int.Parse(input);
int minCuts = N;
if (N == 1) minCuts = 0;
else if (N == 2)
minCuts = 1;
else
{
for (int i = 2; i <= N / 2; i++)
{
if (N % i == 0)
{
minCuts = Math.Min(minCuts, N / i);
}
}
}
File.WriteAllText("OUTPUT.TXT", minCuts.ToString());