https://www.acmicpc.net/problem/14681
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int x = in.nextInt();
int y = in.nextInt();
if(x > 0) {
if(y > 0) {
System.out.println(1);
}
else {
System.out.println(4);
}
}
else {
if(y>0) {
System.out.println(2);
}
if(y<0) {
System.out.println(3);
}
}
}
}
https://www.acmicpc.net/problem/2525
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int a = in.nextInt();
int b = in.nextInt();
int x = in.nextInt();
int y = b + x;
a = a + (y/60);
b = (y%60);
if(a >= 24) {
a = a - 24;
}
System.out.printf("%d %d", a, b);
}
}
https://www.acmicpc.net/problem/2480
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int a = in.nextInt();
int b = in.nextInt();
int c = in.nextInt();
int d;
if(a==b && b==c) {
d = (10000 + (a*1000));
System.out.println(d);
}
else if(a==b || a==c) {
d = (1000 + (a*100));
System.out.println(d);
}
else if(b==c) {
d = (1000 + (b*100));
System.out.println(d);
}
else {
d = (Math.max(Math.max(a,b),c)*100);
System.out.println(d);
}
}
}
https://www.acmicpc.net/problem/2739
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int a = in.nextInt();
for (int i=1; i<=9; i++) {
System.out.printf("%d * %d = %d\n", a, i, (a*i));
}
}
}
https://www.acmicpc.net/problem/10871
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int a = in.nextInt();
int b = in.nextInt();
int[] num = new int[a];
for(int i=0; i<a; i++) {
num[i] = in.nextInt();
}
for(int i=0; i<a; i++) {
if(num[i] < b) {
System.out.printf("%d ", num[i]);
}
}
}
}
'Java-Study' 카테고리의 다른 글
Java Study : 4주차 - 백준 문제풀이 (0) | 2022.11.26 |
---|---|
Java Study : 4주차 정리 - 배열과 ArrayList, 상속과 다형성 (0) | 2022.11.26 |
Java Study : 3주차 정리 (0) | 2022.11.18 |
Java Study : 2주차 정리 (0) | 2022.11.07 |
Java Study : 1주차 정리 (0) | 2022.11.06 |