728x90
반응형

C#/C# (백준) 35

[C#] 백준 알고리즘 2480, 주사위 세개

if마다 Console.WriteLine을 쓰지않고 money를 만들어주었다. using System; public class bj2480 { public static void Main(string[] args) { String[] dice = Console.ReadLine().Split(); int a = int.Parse(dice[0]); int b = int.Parse(dice[1]); int c = int.Parse(dice[2]); int money=0; if (a==b && a==c && b==c){ money = 10000+a*1000; } else if (a==b){ money = 1000+a*100; } else if (a==c){ money = 1000+a*100; } else if (..

C#/C# (백준) 2022.07.22

[C#] 백준 알고리즘 2884번, 오븐 시계

알람 시계는 빼준 것이였다면 오븐 시계는 더해주는 형식. while문을 추가하여 작성하였다. 1. 처음 작성한 코드 .. using System; public class bj2525 { public static void Main(string[] args) { string[] htime = Console.ReadLine().Split(); int h = int.Parse(htime[0]); int m = int.Parse(htime[1]); int c = int.Parse(Console.ReadLine()); m+=c; if (m>60){ h+=1; m-=60; if (h>23){ h=0; } } Console.WriteLine($"{h} {m}"); } } 2. 답안 코드 using System; pub..

C#/C# (백준) 2022.07.21
728x90
반응형