반응형
1086번
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
String[] numbers = br.readLine().split(" ");
int w = Integer.parseInt(numbers[0]);
int h = Integer.parseInt(numbers[1]);
int b = Integer.parseInt(numbers[2]);
double mb = w * h * b;
mb = mb / 8 / 1024 / 1024;
bw.write(String.format("%.2f MB", mb));
bw.flush();
bw.close();
}
}
1087번
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
int num = Integer.parseInt(br.readLine());
int sum = 0;
int n = 1;
while (sum < num) {
sum = sum + n;
n++;
}
bw.write(String.valueOf(sum));
bw.flush();
bw.close();
}
}
1088번
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
int num = Integer.parseInt(br.readLine());
for (int i = 0; i <= num; i++) {
if (i % 3 != 0) {
bw.write(String.valueOf(i) + " ");
}
}
bw.flush();
bw.close();
}
}
1089번
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
String[] numbers = br.readLine().split(" ");
int a = Integer.parseInt(numbers[0]);
int d = Integer.parseInt(numbers[1]);
int n = Integer.parseInt(numbers[2]);
int result = d * (n - 1) + a;
bw.write(String.valueOf(result));
bw.flush();
bw.close();
}
}
1090번
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
String[] numbers = br.readLine().split(" ");
int a = Integer.parseInt(numbers[0]);
int r = Integer.parseInt(numbers[1]);
int n = Integer.parseInt(numbers[2]);
long result = (a * (long) Math.pow(r, n - 1));
bw.write(String.valueOf(result));
bw.flush();
bw.close();
}
}
반응형
'알고리즘 > 코드업 기초 100제' 카테고리의 다른 글
[JAVA]코드업 1096번 ~ 1100번 (0) | 2021.05.04 |
---|---|
[JAVA]코드업 1091번 ~ 1095번 (0) | 2021.05.04 |
[JAVA]코드업 1081번 ~ 1085번 (0) | 2021.05.02 |
[JAVA]코드업 1076번 ~ 1080번 (0) | 2021.05.02 |
[JAVA]코드업 1071번 ~ 1075번 (0) | 2021.05.02 |