반응형
# 알고리즘 문제연습4
## 16진수 구구단 출력 (%x)
- 16진수 구구단 출력
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int num = scanner.nextInt(16);
for ( int i = 1; i <= 15; i++ ) {
System.out.format("%X+%X=%X\n", num, i, num*i);
}
}
}
## 빛 섞어 색 만들기 (BufferedWriter, OutputStreamWriter, IOException)
- 빛 섞어 색 만들기
import java.util.Scanner;
import java.io.BufferedWriter;
import java.io.OutputStreamWriter;
import java.io.IOException;
public class Main {
public static void main(String[] args) throws IOException {
Scanner scanner = new Scanner(System.in);
int a = scanner.nextInt();
int b = scanner.nextInt();
int c = scanner.nextInt();
BufferedWriter bf = new BufferedWriter(new OutputStreamWriter(System.out));
for ( int i = 0; i < a; i++ ) {
for ( int k = 0; k < b; k++ ) {
for ( int l = 0; l < c; l++ ) {
String st = i + " " + k + " " + l;
bf.write(st + "\n");
}
}
}
bf.write(Integer.toString(a*b*c));
bf.close();
}
}
반응형
'기타' 카테고리의 다른 글
(면접 예상) 99단, 최대공약수, MVC패턴, request/response (0) | 2020.10.03 |
---|---|
알고리즘 문제연습5 (0) | 2020.10.02 |
알고리즘 문제연습3 (0) | 2020.10.01 |
알고리즘 문제연습2 (0) | 2020.09.30 |
알고리즘 문제연습1 (0) | 2020.09.29 |