Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
Tags
- greedy
- 파이썬
- 코딩테스트
- 구현
- array
- simulation
- geometry
- SQL
- implement
- Tree
- Method
- bit manipulation
- Stack
- two pointers
- hash table
- Class
- Counting
- 자바
- sorting
- java
- 코테
- Data Structure
- Matrix
- database
- string
- Math
- Binary Search
- dynamic programming
- Binary Tree
- Number Theory
Archives
- Today
- Total
코린이의 소소한 공부노트
[백준 온라인 저지] 14681. 사분면 고르기 본문
- 입력: 첫 줄에는 정수 x가 주어진다. (−1000 ≤ x ≤ 1000; x ≠ 0) 다음 줄에는 정수 y가 주어진다. (−1000 ≤ y ≤ 1000; y ≠ 0)
- 출력: 점 (x, y)의 사분면 번호(1, 2, 3, 4 중 하나)를 출력한다.
import java.util.*;
class Main{
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
if(scan.nextInt()>0){
if(scan.nextInt()>0) System.out.println(1);
else System.out.println(4);
} else{
if(scan.nextInt()>0) System.out.println(2);
else System.out.println(3);
}
}
}
'코딩테스트 풀이 > JAVA' 카테고리의 다른 글
[백준 온라인 저지] 2525. 오븐 시계 (0) | 2023.03.17 |
---|---|
[백준 온라인 저지] 2884. 알람 시계 (0) | 2023.03.17 |
[백준 온라인 저지] 2753. 윤년 (0) | 2023.03.17 |
[백준 온라인 저지] 9498. 시험 성적 (0) | 2023.03.17 |
[백준 온라인 저지] 1330. 두 수 비교하기 (0) | 2023.03.17 |