문제 1330) 두 수 비교하기
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuffer id = new StringBuffer(br.readLine());
id.append("??!");
System.out.print(id);
}
}
문제 9498) 시험 성적
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.BufferedReader;
public class Main {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int score = Integer.parseInt(br.readLine());
if(score>=90) {
System.out.println("A");
}
else if(score>=80) {
System.out.println("B");
}
else if(score>=70) {
System.out.println("C");
}
else if(score>=60) {
System.out.println("D");
}
else {
System.out.println("F");
}
}
}
문제 2753) 윤년
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.BufferedReader;
public class Main {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int year = Integer.parseInt(br.readLine());
if(year%4==0) {
if(year%100==0 && year%400!=0) {
System.out.println("0");
}
else {
System.out.println("1");
}
}
else {
System.out.println("0");
}
}
}
문제 14681) 사분면 고르기
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int x = Integer.parseInt(br.readLine());
int y = Integer.parseInt(br.readLine());
if(x>0) {
if(y>0) {
System.out.println("1");
}
else {
System.out.println("4");
}
}
else {
if(y>0) {
System.out.println("2");
}
else {
System.out.println("3");
}
}
}
}
문제 2884) 알람 시계
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
int H = Integer.parseInt(st.nextToken());
int M = Integer.parseInt(st.nextToken());
M-=45;
if(M<0) {
M+=60;
H-=1;
}
if(H<0) {
H=23;
}
System.out.println(H + " " + M);
}
}
문제 2525) 오븐 시계
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
int hour = Integer.parseInt(st.nextToken());
int min = Integer.parseInt(st.nextToken());
int cook = Integer.parseInt(br.readLine());
int cook_h = cook/60;
int cook_m = cook%60;
hour = hour + cook_h;
min = min+cook_m;
if(min >= 60) {
min = min-60;
hour++;
}
if(hour>=24) {
hour%=24;
}
System.out.println(hour + " " + min);
}
}
문제 2480) 주사위 세개
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
int prize=0;
int dice[] = new int[7];
for(int i=0;i<3;i++) {
dice[Integer.parseInt(st.nextToken())]++;
}
for(int i=1;i<7;i++) {
if(dice[i]==3) {
prize = 10000 + i*1000;
break;
}
if(dice[i]==2) {
prize = 1000 + i*100;
break;
}
if(dice[i]==1) {
prize = 100 * i;
}
}
System.out.println(prize);
}
}