문제 2739번) 구구단
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int N = Integer.parseInt(br.readLine());
StringBuilder sb = new StringBuilder();
for(int i=1;i<=9;i++) {
sb.append(N + " * " + i + " = " + i*N).append("\n");
}
System.out.print(sb);
}
}
문제 10950번) A+B-3
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException{
BufferedReader br =new BufferedReader(new InputStreamReader(System.in));
int T = Integer.parseInt(br.readLine());
StringTokenizer st;
StringBuilder sb = new StringBuilder();
int num1, num2;
for(int i=0;i<T;i++) {
st = new StringTokenizer(br.readLine());
num1 = Integer.parseInt(st.nextToken());
num2 = Integer.parseInt(st.nextToken());
sb.append(num1+num2).append("\n");
}
System.out.print(sb);
}
}
문제 8393번) 합
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int num = Integer.parseInt(br.readLine());
num = (num*(num+1))/2;
System.out.println(num);
}
}
문제 15552번) 빠른 A+B
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.BufferedWriter;
import java.io.OutputStreamWriter;
import java.util.StringTokenizer;
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 T = Integer.parseInt(br.readLine());
StringBuilder sb = new StringBuilder();
StringTokenizer st;
int num1, num2;
for(int i=0;i<T;i++) {
st = new StringTokenizer(br.readLine());
num1 = Integer.parseInt(st.nextToken());
num2 = Integer.parseInt(st.nextToken());
sb.append(num1+num2).append("\n");
}
bw.write(sb.toString());
bw.flush();
}
}
문제 2741번) N 찍기
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
int num = Integer.parseInt(br.readLine());
for(int i=1;i<=num;i++) {
sb.append(i).append("\n");
}
System.out.print(sb);
}
}
문제 2742번) 기찍 N
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int N = Integer.parseInt(br.readLine());
StringBuilder sb = new StringBuilder();
for(int i =N;i>=1 ; i--) {
sb.append(i).append("\n");
}
System.out.print(sb);
}
}
문제 11021번) A+B-7
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int T = Integer.parseInt(br.readLine());
StringTokenizer st;
int num1, num2;
StringBuilder sb = new StringBuilder();
for(int i=0;i<T;i++) {
st = new StringTokenizer(br.readLine());
num1 = Integer.parseInt(st.nextToken());
num2 = Integer.parseInt(st.nextToken());
sb.append("Case #").append(i+1).append(": ").append(num1+num2).append("\n");
}
System.out.print(sb);
}
}
문제 11022번) A+B-8
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int T = Integer.parseInt(br.readLine());
StringBuilder sb = new StringBuilder();
StringTokenizer st;
int num1, num2;
for(int i=0;i<T;i++) {
st = new StringTokenizer(br.readLine());
num1 = Integer.parseInt(st.nextToken());
num2 = Integer.parseInt(st.nextToken());
sb.append("Case #").append(i+1).append(": ").append(num1).append(" + ").append(num2).append(" = ").append(num1+num2).append("\n");
}
System.out.print(sb);
}
}
문제 2438번) 별 찍기-1
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int N = Integer.parseInt(br.readLine());
StringBuilder sb = new StringBuilder();
for(int i=0;i<N;i++) {
for(int j=0;j<=i;j++) {
sb.append("*");
}
sb.append("\n");
}
System.out.print(sb);
}
}
문제 2439번) 별 찍기-2
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int N = Integer.parseInt(br.readLine());
StringBuilder sb = new StringBuilder();
for(int i=0;i<N;i++) {
for(int j=1;j<N-i;j++) {
sb.append(" ");
}
for(int j=0;j<=i;j++) {
sb.append("*");
}
sb.append("\n");
}
System.out.print(sb);
}
}
문제 10871번) X보다 작은 수
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
int N = Integer.parseInt(st.nextToken());
int X = Integer.parseInt(st.nextToken());
StringBuilder sb = new StringBuilder();
st = new StringTokenizer(br.readLine());
int num;
for(int i=0;i<N;i++) {
num = Integer.parseInt(st.nextToken());
if(num<X) {
sb.append(num).append(" ");
}
}
System.out.println(sb);
}
}
문제 10952번) A+B-5
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
int num1, num2;
StringTokenizer st = new StringTokenizer(br.readLine());
while(true) {
num1 = Integer.parseInt(st.nextToken());
num2 = Integer.parseInt(st.nextToken());
if(num1 == 0 && num2 ==0)
break;
sb.append(num1+num2).append("\n");
st = new StringTokenizer(br.readLine());
}
System.out.print(sb);
}
}
문제 10951번) A+B-4
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
StringTokenizer st;
String input;
int num1, num2;
while((input=br.readLine())!=null) {
st = new StringTokenizer(input);
num1 = Integer.parseInt(st.nextToken());
num2 = Integer.parseInt(st.nextToken());
sb.append(num1+num2).append("\n");
}
System.out.print(sb);
}
}
문제 1110번) 더하기 사이클
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int num = Integer.parseInt(br.readLine());
int temp = num;
int i = 0;
while(true) {
temp = (temp/10 + temp%10)%10 + temp%10*10;
i++;
if(temp==num)
break;
}
System.out.println(i);
}
}