제목에 링크를 입력하면 해당 문제로 이동합니다.
1 | 2739 | 구구단 | Java |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int x = scan.nextInt();
for(int i=1; i<10; i++)
System.out.println(x+ " * " + i + " = " + x*i);
scan.close();
}
}
2 | 10950 | A+B - 3 | Java |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int T = scan.nextInt();
for(int i=0; i<T; i++) {
int a = scan.nextInt();
int b = scan.nextInt();
System.out.println(a+b);
}
scan.close();
}
}
3 | 8393 | 합 | Java |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
for(int x = n-1; x!=0; x--) {
n += x;
}
System.out.println(n);
scan.close();
}
}
4 | 15552 | 빠른 A+B | Java |
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 bfr = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bfw = new BufferedWriter(new OutputStreamWriter(System.out));
int T = Integer.parseInt(bfr.readLine());
for(int i=0; i < T; i++) {
String A[] = bfr.readLine().split(" ");
bfw.write(Integer.toString(Integer.parseInt(A[0])+Integer.parseInt(A[1])) + "\n");
}
bfw.flush();
bfw.close();
}
}
5 | 2741 | N 찍기 | Java |
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 {
// TODO Auto-generated method stub
BufferedReader bfr = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bfw = new BufferedWriter(new OutputStreamWriter(System.out));
int T = Integer.parseInt(bfr.readLine());
for(int i=0; i < T; i++) {
bfw.write(Integer.toString(i+1) + '\n');
}
bfw.flush();
bfw.close();
}
}
5 | 2741 | N 찍기 | Java |
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 {
// TODO Auto-generated method stub
BufferedReader bfr = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bfw = new BufferedWriter(new OutputStreamWriter(System.out));
int T = Integer.parseInt(bfr.readLine());
for(int i=0; i < T; i++) {
bfw.write(Integer.toString(i+1) + '\n');
}
bfw.flush();
bfw.close();
}
}
6 | 2742 | 기찍 N | Java |
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 {
// TODO Auto-generated method stub
BufferedReader bfr = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bfw = new BufferedWriter(new OutputStreamWriter(System.out));
int T = Integer.parseInt(bfr.readLine());
for(int i=T; i > 0; i--) {
bfw.write(Integer.toString(i));
bfw.newLine();;
}
bfw.flush();
bfw.close();
bfr.close();
}
}
7 | 11021 | A+B - 7 | Java |
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 bfr = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bfw = new BufferedWriter(new OutputStreamWriter(System.out));
int T = Integer.parseInt(bfr.readLine());
for(int i=0; i < T; i++) {
String A[] = bfr.readLine().split(" ");
bfw.write("Case #" + Integer.toString(i+1)+ ": ");
bfw.write(Integer.toString(Integer.parseInt(A[0])+Integer.parseInt(A[1])));
bfw.newLine();
}
bfw.flush();
bfw.close();
bfr.close();
}
}
8 | 11022 | A+B - 8 | Java |
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 bfr = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bfw = new BufferedWriter(new OutputStreamWriter(System.out));
int T = Integer.parseInt(bfr.readLine());
for(int i=0; i < T; i++) {
String A[] = bfr.readLine().split(" ");
bfw.write("Case #" + Integer.toString(i+1)+ ": " +A[0] + " + " + A[1] + " = ");
bfw.write(Integer.toString(Integer.parseInt(A[0])+Integer.parseInt(A[1])));
bfw.newLine();
}
bfw.flush();
bfw.close();
bfr.close();
}
}
9 | 2438 | 별 찍기 - 1 | Java |
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 bfr = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bfw = new BufferedWriter(new OutputStreamWriter(System.out));
int T = Integer.parseInt(bfr.readLine());
for(int i=1; i < T+1; i++) {
for(int j=0; j<i; j++)
bfw.write("*");
bfw.newLine();
}
bfw.flush();
bfw.close();
bfr.close();
}
}
10 | 2439 | 별 찍기 - 2 | Java |
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 bfr = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bfw = new BufferedWriter(new OutputStreamWriter(System.out));
int T = Integer.parseInt(bfr.readLine());
for(int i=1; i<=T; i++) {
for(int j=0; j<T-i; j++)
bfw.write(" ");
for(int z = 0; z<i; z++)
bfw.write("*");
bfw.newLine();
}
bfw.flush();
bfw.close();
bfr.close();
}
}
11 | 10871 | X보다 작은 수 | Java |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int A = scanner.nextInt();
int X = scanner.nextInt();
int C[] = new int [A];
for(int i=0; i<A; i++) {
int N = scanner.nextInt();
if(N<X) {
C[i] = N;
}
}
for(int i=0; i<A; i++)
if(C[i] != 0)
System.out.print(C[i] + " ");
}
}
728x90
반응형