일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- Orace 18c
- 오라클 캐릭터셋 조회
- 오라클 캐릭터셋 변경
- Oracle 테이블 대소문자
- Oracle Express Edition
- Oracle 18c 설치
- 서평단
- 오라클 캐릭터셋 확인
- Oracle 윈도우 설치
- Oracle 테이블 띄어쓰기
- 윈도우 Oracle
- Oracle 18c HR
- 무료 오라클 설치
- 비전공자를 위한 데이터베이스 입문
- ORA-12899
- Oracle 초기 사용자
- oracle 18c
- 무료 오라클 데이터베이스
- Oracle 사용자명
- ORA-00922
- oracle
- Oracle 18c HR schema
- ora-01722
- Oracle 사용자명 입력
Archives
- Today
- Total
The Nirsa Way
[백준] 알고리즘 단계별로 풀어보기 - 2 (자바) 본문
반응형
알고리즘 단계별로 풀어보기 - 2 (자바)
맨처음 브론즈 5였던것 같은데 풀다보니 브론즈 3이 되었네요! 슬슬 벌써 어려워지는데 큰일이네요 ㅠㅠ
2480번: 주사위 세개
지난번에 도저히 눈에 안보였는데... 백준 사이트에서 천사분이 콕 찝어주셨네요!
19, 21, 23 라인의 or 연산이 문제였습니다. and연산으로 바꿔준 후 드디어 해결..ㅠㅠ
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
short A = sc.nextShort();
short B = sc.nextShort();
short C = sc.nextShort();
if(A==B && B==C) {
System.out.printf("%d", (10000+(A*1000)));
} else if(A==B || B==C || A==C) {
if(A==B || B==C) {
System.out.printf("%d", (1000+(B*100)));
} else if(A==C) {
System.out.printf("%d", (1000+(A*100)));
}
} else if(A!=B && B!=C) {
if(A>B && A>C) {
System.out.printf("%d", (A*100));
} else if(B>C && B>A) {
System.out.printf("%d", (B*100));
} else if(C>A && C>B) {
System.out.printf("%d", (C*100));
}
}
}
}
2741번: N 찍기
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int input = sc.nextInt();
int num = 1;
for(int i=0; i<input; i++) {
System.out.println(num++);
}
}
}
2742번: 기찍 N
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int input = sc.nextInt();
int num = input;
for(int i=0; i<input; i++) {
System.out.println(num--);
}
}
}
11021번: A+B - 7
이상하게 왜 자꾸 틀렸다고 한건지 이해를 못했었는데, printf를 사용하면 개행 문자까지 해주어야 맞은걸로 처리 되네요.
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
for(int i=1; i<=T; i++) {
int A = sc.nextInt() + sc.nextInt();
System.out.printf("Case #%d: %d \n", i, A);
}
}
}
11022번: A+B - 8
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
for(int i=1; i<=T; i++) {
int A = sc.nextInt();
int B = sc.nextInt();
System.out.printf("Case #%d: %d + %d = %d\n", i, A, B, (A+B));
}
}
}
2438번: 별 찍기 - 1
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
for(int i=0; i<T; i++) {
for(int j=0; j<i+1; j++) {
System.out.printf("*");
}
System.out.println();
}
}
}
2439번: 별 찍기 - 2
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
for(int i=0; i<T; i++) {
for(int j=T; j-1>i; j--) {
System.out.print(" ");
}
for(int j=0; j<i+1; j++) {
System.out.printf("*");
}
System.out.println();
}
}
}
10871번: X보다 작은 수
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int X = sc.nextInt();
int[] A = new int[N];
for(int i=0; i<A.length; i++) {
A[i] = sc.nextInt();
if(A[i] < X) {
System.out.printf("%d ", A[i]);
}
}
}
}
반응형
'코딩 테스트 > 백준' 카테고리의 다른 글
[백준] 2577번: 숫자의 개수 (JAVA, 자바) (0) | 2022.03.15 |
---|---|
[백준] 2562번: 최댓값 (JAVA, 자바) (0) | 2022.03.15 |
[백준] 10818번: 최소, 최대 (JAVA, 자바) (0) | 2022.03.15 |
[백준] 알고리즘 단계별로 풀어보기 - 3 (자바) (0) | 2022.03.09 |
[백준] 알고리즘 단계별로 풀어보기 - 1 (자바) (0) | 2022.03.06 |