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
- hash table
- array
- Method
- Binary Tree
- Stack
- Number Theory
- bit manipulation
- 파이썬
- implement
- 코테
- greedy
- Binary Search
- java
- Data Structure
- Math
- dynamic programming
- 코딩테스트
- Counting
- string
- 구현
- two pointers
- geometry
- database
- SQL
- sorting
- simulation
- Class
- Matrix
- Tree
- 자바
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 |