본문 바로가기
반응형

전체 글552

백준 C# 14681 using System; namespace baek2 { class Program { static void Main(string[] args) { string input_x = Console.ReadLine(); string input_y = Console.ReadLine(); int x = int.Parse(input_x); int y = int.Parse(input_y); if ((x > 0 ) && (y > 0)) Console.WriteLine(1); else if ((x 0)) Console.WriteLine(2); else if ((x < 0) && (y < 0)) Console.WriteLine(3); else Console.WriteLine(4); } } } 2023. 4. 7.
백준 C# 2753 using System; namespace baek2 { class Program { static void Main(string[] args) { string year_input = Console.ReadLine(); int year = int.Parse(year_input); if ((year % 4 == 0) && (year % 100 != 0)) Console.WriteLine(1); else if ((year % 100 == 0) && (year % 400 == 0)) Console.WriteLine(1); else Console.WriteLine(0); } } } 2023. 4. 7.
백준 C# 9498 using System; namespace baek2 { class Program { static void Main(string[] args) { string score_input = Console.ReadLine(); int score = int.Parse(score_input); if (score >= 90 && score = 80 && score = 70 && score = 60 && score 2023. 4. 7.
백준 C# 1330 using System; namespace baek2 { class Program { static void Main(string[] args) { string input = Console.ReadLine(); string[] token = input.Split(); int A = int.Parse(token[0]); int B = int.Parse(token[1]); if (A < B) Console.WriteLine(""); else Console.WriteLine("=="); } } } 2023. 4. 7.
백준 C# 11382 +) int, long 차이 using System; namespace baek2 { class Program { static void Main(string[] args) { string input = Console.ReadLine(); string[] token = input.Split(); long A = long.Parse(token[0]); long B = long.Parse(token[1]); long C = long.Parse(token[2]); Console.WriteLine($"{(A + B + C)}"); } } } 1 ≤ A, B, C ≤ 10¹² 문제에서 A,B,C의 범위가 int 범위보다 크므로 long을 사용해주어야 한다. int(32bit) : –2,147,483,648 ~ 2,147,483,647 uint.. 2023. 4. 7.
백준 C# 2588 using System; namespace baek2 { class Program { static void Main(string[] args) { string inputA, inputB; inputA = Console.ReadLine(); inputB = Console.ReadLine(); int A = int.Parse(inputA); int B = int.Parse(inputB); Console.WriteLine($"{(A * (B%10))}"); Console.WriteLine($"{(A * ((B/10)%10))}"); Console.WriteLine($"{(A * (B/100))}"); Console.WriteLine($"{(A * B)}"); } } } 2023. 4. 7.
반응형