반응형
1076번
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));
char word = (char) br.read();
for (char i = 'a'; i <= word; i++) {
bw.write(String.valueOf((i)) + " ");
}
bw.flush();
bw.close();
}
}
1077번
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));
StringBuilder sb = new StringBuilder();
int count = Integer.parseInt(br.readLine());
for (int i = 0; i <= count; i++) {
sb.append(String.valueOf(i) + "\n");
}
sb.deleteCharAt(sb.length() - 1);
bw.write(sb.toString());
bw.flush();
bw.close();
}
}
1078번
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 count = Integer.parseInt(br.readLine());
int sum = 0;
for (int i = 0; i <= count; i++) {
if (i % 2 == 0) {
sum = sum + i;
}
}
bw.write(String.valueOf(sum));
bw.flush();
bw.close();
}
}
1079번
import java.io.IOException;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IOException {
Scanner scan = new Scanner(System.in);
while (true) {
String word = scan.next();
if (word.equals("q")) {
System.out.println(word);
break;
} else {
System.out.println(word);
}
}
scan.close();
}
}
1080번
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 count = Integer.parseInt(br.readLine());
int n = 1;
while ((n * (n + 1)) / 2 < count) {
n++;
}
bw.write(String.valueOf(n));
bw.flush();
bw.close();
}
}
반응형
'알고리즘 > 코드업 기초 100제' 카테고리의 다른 글
[JAVA]코드업 1086번 ~ 1090번 (0) | 2021.05.03 |
---|---|
[JAVA]코드업 1081번 ~ 1085번 (0) | 2021.05.02 |
[JAVA]코드업 1071번 ~ 1075번 (0) | 2021.05.02 |
[JAVA]코드업 1066번 ~ 1070번 (0) | 2021.04.30 |
[JAVA]코드업 1061번 ~ 1065번 (0) | 2021.04.30 |