-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy path1189 - Área Esquerda.cs
60 lines (50 loc) · 1.42 KB
/
1189 - Área Esquerda.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
using System;
//Developed by: @LucasMarcuzo
namespace _1189___Área_Esquerda
{
class Program
{
static void Main(string[] args)
{
float[,] x = new float[12,12];
char tipo;
tipo = char.Parse(Console.ReadLine().ToUpper());
for (int i = 0; i < 12; i++)
{
for (int j = 0; j < 12; j++)
{
x[i,j] = Convert.ToSingle(Console.ReadLine());
}
}
float total = 0;
for (int i = 5; i < 7; i++)
{
total += x[i,4];
}
for (int j = 4; j < 8; j++)
{
total += x[j,3];
}
for (int k = 3; k < 9; k++)
{
total += x[k,2];
}
for (int l = 2; l < 10; l++)
{
total += x[l,1];
}
for (int m = 1; m < 11; m++)
{
total += x[m,0];
}
if (tipo == 'S')
{
Console.WriteLine("{0:F1}",total);
}
else if (tipo == 'M')
{
Console.WriteLine("{0:F1}",total/30.0f);
}
}
}
}