반응형 전체 글552 C# - 배열에서 최댓값 최솟값 1. max, min 값 설정하기 주어진 조건의 최솟값을 max변수의 값으로 설정하고 최댓값을 min변수의 값으로 설정한다. 예를 들어서 입력되는 정수의 값의 범위가 -100 2023. 4. 11. 백준 C# 10810 using System; using System.Collections.Generic; using System.Text; namespace baek2 { class Program { static void Main(string[] args) { string input_NM = Console.ReadLine(); string[] token_NM = input_NM.Split(); int N = int.Parse(token_NM[0]); int M = int.Parse(token_NM[1]); int[] arr = new int[N]; for(int i=0; i < N; i++) { arr[i] = 0; } for (int i = 0; i < M; i++) { string input = Console.ReadL.. 2023. 4. 11. 백준 C# 2562 using System; using System.Collections.Generic; using System.Text; namespace baek2 { class Program { static void Main(string[] args) { int[] arr = new int[9]; int count = 0; int max = 0; for (int i = 0; i max) { max = arr[i]; count = i; } } Console.WriteLine(max); Console.WriteLine(count+1); } } } 2023. 4. 11. 백준 C# 10818 배열에서 최댓값 최솟값 구하는 방법 알아보러 가기 배열에서 최댓값 최솟값 배열에서 최댓값 최솟값 구하기 1. max, min 값 설정하기 주어진 조건의 최솟값을 max변수의 값으로 설정하고 최댓값을 min변수의 값으로 설정한다. 예를 들어서 입력되는 정수의 값의 범위가 -100 code-piggy.tistory.com using System; using System.Collections.Generic; using System.Text; namespace baek2 { class Program { static void Main(string[] args) { string input = Console.ReadLine(); int n = int.Parse(input); string input_list = Con.. 2023. 4. 11. 백준 C# 10871 using System; using System.Collections.Generic; using System.Text; namespace baek2 { class Program { static void Main(string[] args) { string input_n = Console.ReadLine(); string[] token_n = input_n.Split(); int n = int.Parse(token_n[0]); int x = int.Parse(token_n[1]); string input_list = Console.ReadLine(); string[] token = input_list.Split(); int[] arr = new int[n]; for(int i=0; i 2023. 4. 11. 백준 C# 10807 using System; using System.Collections.Generic; using System.Text; namespace baek2 { class Program { static void Main(string[] args) { string input_n = Console.ReadLine(); int n = int.Parse(input_n); string input_list = Console.ReadLine(); string[] token = input_list.Split(); List list = new List(); string input_v = Console.ReadLine(); int v = int.Parse(input_v); int count = 0; for(int i=0; i 2023. 4. 11. 이전 1 ··· 81 82 83 84 85 86 87 ··· 92 다음 반응형