제목에 링크를 입력하면 해당 문제로 이동합니다.
1 | 1330 | 두 수 비교하기 | Java |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int A = scan.nextInt();
int B = scan.nextInt();
if(A >B)
System.out.println(">");
if(A<B)
System.out.println("<");
if(A==B)
System.out.println("==");
}
}
2 | 9498 | 시험 성적 | Java |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int A = scan.nextInt();
if(A>89)
System.out.println("A");
else if(79<A && A<90)
System.out.println("B");
else if(69<A && A <80)
System.out.println("C");
else if(59<A && A < 70)
System.out.println("D");
else
System.out.println("F");
scan.close();
}
}
3 | 2753 | 윤년 | Java |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int year = scan.nextInt();
if(year%4==0 && (year%100!=0 || year %400 ==0))
System.out.println("1");
else
System.out.println("0");
scan.close();
}
}
4 | 14681 | 사분면 고르기 | Java |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int x = scan.nextInt();
int y = scan.nextInt();
if(x>0 && y>0)
System.out.println("1");
else if(x<0 && y>0)
System.out.println("2");
else if(x<0 && y<0)
System.out.println("3");
else if(x>0 && y<0)
System.out.println("4");
else
System.out.println("error");
scan.close();
}
}
5 | 2884 | 알람 시계 | Java |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int hour = scan.nextInt();
int minute = scan.nextInt();
if(minute - 45 <0) {
hour -= 1;
if(hour<0)
hour = 23;
minute = 60 +(minute -45);
}
else minute -= 45;
System.out.print(hour + " ");
System.out.print(minute);
scan.close();
}
}
728x90
반응형