2525번 오븐 시계
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int h = sc.nextInt();
int m = sc.nextInt();
int N = sc.nextInt();
int M=0;
if(N<60){
M=m+N;
if(M<60){
System.out.println(h+" "+M);}
else{
M=M-60;
h=h+1;
if(h>=24){
System.out.println((h-24)+" "+M);
}
else
System.out.println(h+" "+M);
}
}
else if(N>=60){
M=m+N;
int a= M/60;
int b= M%60;
h=h+a;
if(h>=24){
System.out.println((h-24)+" "+b);
}
else
System.out.println(h+" "+b);
}
}
}
- hour가 24를 넘어갈 때 조건 추가 안할 뻔 했다..!
2480번 주사위 세개
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
int money=0;
if(a==b&&b==c)
money=10000+a*1000;
else if((a==b&&a!=c))
money=1000+a*100;
else if (a==c&&a!=b)
money=1000+a*100;
else if(b==c&&b!=a)
money=1000+b*100;
else if(a!=b&&b!=c)
{if(a>b&&a>c)
money=a*100;
else if(b>a&&b>c)
money=b*100;
else if(c>a&&c>b)
money=c*100;
}
System.out.println(money);
}
}