https://www.acmicpc.net/problem/1233
\
import java.util.*;
import java.io.*;
public class Main
{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int s1= sc.nextInt();
int s2= sc.nextInt();
int s3= sc.nextInt();
int[] nums = new int[s1+s2+s3+1];
for(int i=1; i<s1+1;i++){
for(int j=1; j<s2+1;j++){
for(int k=1; k<s3+1; k++){
nums[i+j+k]++;
}
}
}
int maxIndex=0;
for(int i=0; i<nums.length;i++){
if(nums[i]>nums[maxIndex]) maxIndex=i;
}
System.out.println(maxIndex);
}
}
'Problem Solving > 구현' 카테고리의 다른 글
BOJ1110 더하기 사이클 (0) | 2024.02.01 |
---|---|
BOJ2231 분해합 (0) | 2024.02.01 |
BOJ2745 진법 변환 (0) | 2024.02.01 |
BOJ2817 ALPS식 투표 (0) | 2024.01.31 |
BOJ2840 행운의 바퀴 (1) | 2024.01.31 |