Точки: 259 от 300
Точки по задачи
- 64 от 100 точки
- 95 от 100 точки
- 100 от 100 точки
Общ брой участници: 698
Класиране: 163 място
Точки: 259 от 300
Точки по задачи
Общ брой участници: 698
Класиране: 163 място
using System;
namespace NightmareOnCodeStreet {
class Program {
static void Main() {
string number = Console.ReadLine();
char[] numbersList = number.ToCharArray();
int size = numbersList.Length;
if (numbersList[0] - '0' < 0) {
for (int i = 0; i < numbersList.Length - 1; i++) {
numbersList[i] = numbersList[i + 1];
}
size--;
}
int counter = 0;
int sum = 0;
for (int i = 0; i < size; i++) {
if (i % 2 != 0) {
if (Char.IsDigit(numbersList[i])) {
counter++;
sum += (int)(numbersList[i] - '0');
}
}
}
Console.WriteLine("{0} {1}", counter, sum);
}
}
}
using System;
namespace KaspichaniaBoats {
class Program {
static void Main() {
int n = int.Parse(Console.ReadLine());
int boatWidth = 2 * n + 1;
int dots = 1;
for (int i = 0; i < n; i++) {
Console.Write(new string('.', n - i));
if (i == 0) {
Console.Write(new string('*', 1));
} else if (i == 1) {
Console.Write(new string('*', 3));
} else {
Console.Write("*");
Console.Write(new string('.', dots));
Console.Write("*");
Console.Write(new string('.', dots));
Console.Write("*");
dots++;
}
Console.Write(new string('.', n - i));
Console.WriteLine();
}
Console.WriteLine(new string('*', boatWidth));
int counter = 1;
dots = n - 2;
for (int i = 1; i <= n / 2; i++) {
Console.Write(new string('.', i));
Console.Write(new string('*', 1));
Console.Write(new string('.', dots));
Console.Write(new string('*', 1));
Console.Write(new string('.', dots));
Console.Write(new string('*', 1));
Console.Write(new string('.', i));
dots--;
counter++;
Console.WriteLine();
}
Console.Write(new string('.', counter));
Console.Write(new string('*', boatWidth - 2 * counter));
Console.Write(new string('.', counter));
}
}
}
using System;
namespace _2_4_8 {
class Program {
static void Main() {
decimal a = decimal.Parse(Console.ReadLine());
decimal b = decimal.Parse(Console.ReadLine());
decimal c = decimal.Parse(Console.ReadLine());
decimal r = 0;
switch ((int) b) {
case 2:
r = a % c;
break;
case 4:
r = a + c;
break;
case 8:
r = a * c;
break;
}
int remainder = r % 4;
if (remainder == 0) {
Console.WriteLine(r / 4);
} else {
Console.WriteLine(remainder);
}
Console.WriteLine(r);
}
}
}
using System;
using System.Collections.Generic;
namespace Sheets {
class Program {
static void Main() {
int n = int.Parse(Console.ReadLine());
int[] piecesList = new int[11];
Dictionary sheets = new Dictionary();
sheets.Add(0, "A0");
sheets.Add(1, "A1");
sheets.Add(2, "A2");
sheets.Add(3, "A3");
sheets.Add(4, "A4");
sheets.Add(5, "A5");
sheets.Add(6, "A6");
sheets.Add(7, "A7");
sheets.Add(8, "A8");
sheets.Add(9, "A9");
sheets.Add(10, "A10");
piecesList[10] = 1;
for (int i = 9; i >= 0; i--) {
piecesList[i] = piecesList[i + 1] * 2;
}
for (int i = 0; i < piecesList.Length; i++) {
if (n >= piecesList[i]) {
n -= piecesList[i];
sheets.Remove(i);
}
}
foreach(var item in sheets) {
Console.WriteLine(item.Value);
}
}
}
}
using System;
namespace TelerikExamples {
class FireInTheMatrix {
static void Main() {
int fireWidth = int.Parse(Console.ReadLine());
int sideDots = (fireWidth - 2) / 2;
int middleDots = 0;
for (int i = sideDots; i >= 0; i--) {
Console.Write(new string('.', i));
Console.Write(new string('#', 1));
Console.Write(new string('.', middleDots));
Console.Write(new string('#', 1));
Console.Write(new string('.', i));
Console.WriteLine();
middleDots += 2;
}
middleDots = fireWidth - 2;
for (int i = 0; i < fireWidth / 4; i++) {
Console.Write(new string('.', i));
Console.Write(new string('#', 1));
Console.Write(new string('.', middleDots));
Console.Write(new string('#', 1));
Console.Write(new string('.', i));
Console.WriteLine();
middleDots -= 2;
}
Console.WriteLine(new string('-', fireWidth));
int middleSlashes = fireWidth / 2;
for (int i = 0; i < fireWidth / 2; i++) {
Console.Write(new string('.', i));
Console.Write(new string('\\', middleSlashes));
Console.Write(new string('/', middleSlashes));
Console.Write(new string('.', i));
Console.WriteLine();
middleSlashes--;
}
}
}
}
using System;
namespace FormulaBit1 {
class Program {
static int gridSize = 8;
static int[, ] grid = new int[gridSize, gridSize];
static int trackLength = 0;
static int turnsCount = 0;
static char previousDirection = 'D';
static bool finished = false;
static void Main() {
for (int i = 0; i < gridSize; i++) {
int number = int.Parse(Console.ReadLine());
for (int j = 0; j < gridSize; j++) {
int mask = 1 << j;
int numberAndMask = number & mask;
int bit = numberAndMask >> j;
grid[i, gridSize - j - 1] = (bit == 1) ? 1 : 0;
}
}
buildTrack(0, 7, 'D');
if (finished == false) {
Console.WriteLine("No {0}", trackLength);
}
}
static void checkForTrackExit(int row, int column) {
if (row == 7 && column == 0) {
finished = true;
Console.WriteLine("{0} {1}", trackLength, turnsCount);
}
}
static void buildTrack(int row, int column, char currentDirection) {
if (row < 0 || column < 0 || row >= grid.GetLength(0) || column >= grid.GetLength(1)) {
return;
}
if (grid[row, column] == 1) {
return;
}
switch (currentDirection) {
case 'D':
for (int i = row; i < gridSize; i++) {
if (grid[i, column] == 0) {
trackLength += 1;
checkForTrackExit(i, column);
if (i == (gridSize - 1)) {
turnsCount++;
previousDirection = 'D';
buildTrack(i, column - 1, 'L');
}
continue;
} else {
turnsCount++;
previousDirection = 'D';
buildTrack(i - 1, column - 1, 'L');
break;
}
}
break;
case 'L':
for (int i = column; i >= 0; i--) {
if (grid[row, i] == 0) {
trackLength += 1;
checkForTrackExit(row, i);
if (i == 0) {
if (previousDirection == 'D') {
turnsCount++;
previousDirection = 'L';
buildTrack(row - 1, i, 'U');
} else {
turnsCount++;
previousDirection = 'L';
buildTrack(row + 1, i, 'D');
}
}
continue;
} else {
if (previousDirection == 'U') {
turnsCount++;
previousDirection = 'L';
buildTrack(row + 1, i + 1, 'D');
break;
} else {
turnsCount++;
previousDirection = 'L';
buildTrack(row - 1, i + 1, 'U');
break;
}
}
}
break;
case 'U':
for (int i = row; i >= 0; i--) {
if (grid[i, column] == 0) {
trackLength += 1;
checkForTrackExit(i, column);
if (i == 0) {
turnsCount++;
previousDirection = 'U';
buildTrack(i, column - 1, 'L');
}
continue;
} else {
turnsCount++;
previousDirection = 'U';
buildTrack(i + 1, column - 1, 'L');
break;
}
}
break;
}
}
}
}
using System;
namespace Carpets {
class Program {
static void Main() {
int fullSize = int.Parse(Console.ReadLine());
int halfSize = fullSize / 2;
for (int i = 1; i <= halfSize; i++) {
Console.Write(new string('.', halfSize - i));
string str = new string(' ', 2 * i);
char[] chr = str.ToCharArray();
for (int j = 0; j < chr.Length / 2; j++) {
if (j % 2 == 0) {
chr[j] = '/';
chr[chr.Length - j - 1] = '\\';
}
}
str = new string(chr);
Console.Write(str);
Console.Write(new string('.', halfSize - i));
Console.WriteLine();
}
for (int i = 1; i <= halfSize; i++) {
Console.Write(new string('.', i - 1));
string str = new string(' ', 2 * (halfSize + 1) - 2 * i);
char[] chr = str.ToCharArray();
for (int j = 0; j < chr.Length / 2; j++) {
if (j % 2 == 0) {
chr[j] = '\\';
chr[chr.Length - j - 1] = '/';
}
}
str = new string(chr);
Console.Write(str);
Console.Write(new string('.', i - 1));
Console.WriteLine();
}
}
}
}