Skip to content

Commit

Permalink
+10 exercicios resolvidos
Browse files Browse the repository at this point in the history
  • Loading branch information
VictorRicarteSilva committed Apr 18, 2024
1 parent e43a586 commit 5dfaed7
Show file tree
Hide file tree
Showing 31 changed files with 283 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
### Repositorio para manter todos os algoritmos feitos para solucionar os exercicios propostos em https://judge.beecrowd.com/pt/categories
## Progresso: 20/2000+
## Progresso: 30/2000+
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
18 changes: 18 additions & 0 deletions exc1020.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
internal class beecrowd
{
private static void Main(string[] args)
{
int idade = Convert.ToInt32(Console.ReadLine());
int ano, mes, dia;

ano = idade / 365;
idade -= ano * 365;
mes = idade / 30;
idade -= mes * 30;
dia = idade;
Console.WriteLine($"{ano} ano(s)");
Console.WriteLine($"{mes} mes(es)");
Console.WriteLine($"{dia} dia(s)");
}

}
58 changes: 58 additions & 0 deletions exc1021.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
internal class beecrowd
{
private static void Main(string[] args)
{
double valor = Convert.ToDouble(Console.ReadLine());
int nota100, nota50, nota20, nota10, nota5, nota2;
int moeda1, moeda50, moeda25, moeda10, moeda5;

int valorInt;
double valorDouble, moeda01;
// notas
valorInt = (int)valor;
// moedas
valorDouble = valor - valorInt;

// notas
nota100 = valorInt / 100;
valorInt -= nota100 * 100;
nota50 = valorInt / 50;
valorInt -= nota50 * 50;
nota20 = valorInt / 20;
valorInt -= nota20 * 20;
nota10 = valorInt / 10;
valorInt -= nota10 * 10;
nota5 = valorInt / 5;
valorInt -= nota5 * 5;
nota2 = valorInt / 2;
valorInt -= nota2 * 2;

//moedas
moeda1 = valorInt / 1;
moeda50 = (int)(valorDouble / 0.50);
valorDouble -= moeda50 * 0.50;
moeda25 = (int)(valorDouble / 0.25);
valorDouble -= moeda25 * 0.25;
moeda10 = (int)(valorDouble / 0.10);
valorDouble -= moeda10 * 0.10;
moeda5 = (int)(valorDouble / 0.05);
valorDouble -= moeda5 * 0.05;
moeda01 = (valorDouble / 0.01);

Console.WriteLine("NOTAS:");
Console.WriteLine($"{nota100} nota(s) de R$ 100.00");
Console.WriteLine($"{nota50} nota(s) de R$ 50.00");
Console.WriteLine($"{nota20} nota(s) de R$ 20.00");
Console.WriteLine($"{nota10} nota(s) de R$ 10.00");
Console.WriteLine($"{nota5} nota(s) de R$ 5.00");
Console.WriteLine($"{nota2} nota(s) de R$ 2.00");

Console.WriteLine("MOEDAS:");
Console.WriteLine($"{moeda1} moeda(s) de R$ 1.00");
Console.WriteLine($"{moeda50} moeda(s) de R$ 0.50");
Console.WriteLine($"{moeda25} moeda(s) de R$ 0.25");
Console.WriteLine($"{moeda10} moeda(s) de R$ 0.10");
Console.WriteLine($"{moeda5} moeda(s) de R$ 0.05");
Console.WriteLine($"{moeda01:F0} moeda(s) de R$ 0.01"); }

}
20 changes: 20 additions & 0 deletions exc1035.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
internal class beecrowd
{
private static void Main(string[] args)
{
string[] entrada = Console.ReadLine().Split(' ');
int A = Convert.ToInt32(entrada[0]),
B = Convert.ToInt32(entrada[1]),
C = Convert.ToInt32(entrada[2]),
D = Convert.ToInt32(entrada[3]);
if(B > C && D > A && (C + D) > (A + B) && C > 0 && D > 0 && A % 2 == 0)
{
Console.WriteLine("Valores aceitos");
}
else
{
Console.WriteLine("Valores nao aceitos");
}
}

}
24 changes: 24 additions & 0 deletions exc1036.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
internal class beecrowd
{
private static void Main(string[] args)
{
string[] entrada = Console.ReadLine().Split(' ');
double A = Convert.ToDouble(entrada[0]),
B = Convert.ToDouble(entrada[1]),
C = Convert.ToDouble(entrada[2]);
double delta, r1, r2;

delta = (Math.Pow(B, 2)) - (4 * A * C);
if (delta < 0 || A <= 0)
{
Console.WriteLine("Impossivel calcular");
}
else
{
r1 = (-B + Math.Sqrt(delta)) / (2 * A);
r2 = (-B - Math.Sqrt(delta)) / (2 * A);
Console.WriteLine($"R1 = {r1:F5}");
Console.WriteLine($"R2 = {r2:F5}");
}

}
24 changes: 24 additions & 0 deletions exc1037.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
internal class beecrowd
{
private static void Main(string[] args)
{
double valor = Convert.ToDouble(Console.ReadLine());
if(valor < 0 || valor > 100)
{
Console.WriteLine("Fora de intervalo");
}else if (valor <= 25)
{
Console.WriteLine("Intervalo [0,25]");
}else if (valor <= 50)
{
Console.WriteLine("Intervalo (25,50]");
}else if (valor <=75)
{
Console.WriteLine("Intervalo (50,75]");
}else
{
Console.WriteLine("Intervalo (75,100]");
}
}

}
34 changes: 34 additions & 0 deletions exc1038.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
internal class beecrowd
{
private static void Main(string[] args)
{
string[] entrada = Console.ReadLine().Split(' ');
int codigo = Convert.ToInt32(entrada[0]),
quantidade = Convert.ToInt32(entrada[1]);
double comanda;
switch (codigo)
{
case 1:
comanda = quantidade * 4.00;
Console.WriteLine($"Total: R$ {comanda:F2}");
break;
case 2:
comanda = quantidade * 4.50;
Console.WriteLine($"Total: R$ {comanda:F2}");
break;
case 3:
comanda = quantidade * 5.00;
Console.WriteLine($"Total: R$ {comanda:F2}");
break;
case 4:
comanda = quantidade * 2.00;
Console.WriteLine($"Total: R$ {comanda:F2}");
break;
case 5:
comanda = quantidade * 1.50;
Console.WriteLine($"Total: R$ {comanda:F2}");
break;
}
}

}
34 changes: 34 additions & 0 deletions exc1039.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
internal class beecrowd
{
private static void Main(string[] args)
{
string[] entrada = Console.ReadLine().Split(' ');
int codigo = Convert.ToInt32(entrada[0]),
quantidade = Convert.ToInt32(entrada[1]);
double comanda;
switch (codigo)
{
case 1:
comanda = quantidade * 4.00;
Console.WriteLine($"Total: R$ {comanda:F2}");
break;
case 2:
comanda = quantidade * 4.50;
Console.WriteLine($"Total: R$ {comanda:F2}");
break;
case 3:
comanda = quantidade * 5.00;
Console.WriteLine($"Total: R$ {comanda:F2}");
break;
case 4:
comanda = quantidade * 2.00;
Console.WriteLine($"Total: R$ {comanda:F2}");
break;
case 5:
comanda = quantidade * 1.50;
Console.WriteLine($"Total: R$ {comanda:F2}");
break;
}
}

}
33 changes: 33 additions & 0 deletions exc1040.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Wrong aswer (5%) - por conta de uma divergencia entra o C# e o beecrowd, o C# aredonda volores "0.5" para cima e o beecrowd arredonda para baixo.
internal class beecrowd
{
private static void Main(string[] args)
{
string[] entrada = Console.ReadLine().Split(' ');
float N1 = float.Parse(entrada[0]),
N2 = float.Parse(entrada[1]),
N3 = float.Parse(entrada[2]),
N4 = float.Parse(entrada[3]);
float media = ((N1 * 2) + (N2 * 3) + (N3 * 4) + (N4 * 1)) / 10;
Console.WriteLine($"Media: {media:F1}");
if (media >= 7)
{
Console.WriteLine("Aluno aprovado.");
}else if (media < 5)
{
Console.WriteLine("Aluno reprovado.");
}
else
{
Console.WriteLine("Aluno em exame.");
float N = float.Parse(Console.ReadLine());
Console.WriteLine($"Nota do exame: {N:F1}");
if ((N + media) / 2 >= 5)
{
Console.WriteLine("Aluno aprovado.");
Console.WriteLine($"Media final: {(N + media) / 2:F1}");
}
}
}

}
17 changes: 17 additions & 0 deletions exc1041.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
internal class beecrowd
{
private static void Main(string[] args)
{
string[] entrada =(Console.ReadLine().Split(' '));
float x = float.Parse(entrada[0]),
y = float.Parse(entrada[1]);
if(x > 0 && y > 0) Console.WriteLine("Q1");
if(x < 0 && y > 0) Console.WriteLine("Q2");
if(x < 0 && y < 0) Console.WriteLine("Q3");
if(x > 0 && y < 0) Console.WriteLine("Q4");
if(x == 0 && y == 0) Console.WriteLine("Origem");
if(x == 0 && y != 0) Console.WriteLine("Eixo Y");
if(y == 0 && x != 0) Console.WriteLine("Eixo X");
}

}
20 changes: 20 additions & 0 deletions exc1042.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
internal class beecrowd
{
private static void Main(string[] args)
{
string[] entrada = (Console.ReadLine().Split(' '));
int v1 = Convert.ToInt32(entrada[0]),
v2 = Convert.ToInt32(entrada[1]),
v3 = Convert.ToInt32(entrada[2]);
int[] ints = {v1 , v2 , v3 };
Array.Sort(ints);
Console.WriteLine(ints[0]);
Console.WriteLine(ints[1]);
Console.WriteLine(ints[2]);
Console.WriteLine();
Console.WriteLine(v1);
Console.WriteLine(v2);
Console.WriteLine(v3);
}

}

0 comments on commit 5dfaed7

Please sign in to comment.