🔥Baekjoon start🔥

ariel·2021년 11월 1일
0

Baekjoon

목록 보기
2/14
post-thumbnail

2021-11-01

✍쪠와 함께 하루에 30분 이상 시작✨

💻 for문

2739

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N; 
		N = sc.nextInt();
	
			for(int m=1; m<=9; m++) {
				System.out.println(N + " * "+ m + " = " + (N*m));
			}
			
		}
			
	}

10950

package study01;

import java.util.Scanner;

public class Main {Sys
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int T; 
		
		T = sc.nextInt();
		
		 for(int i=1; i<=T; i++) {
			 int A, B;
			A = sc.nextInt();
			B = sc.nextInt();
			 System.out.println(A+B);
		 }
			
	 }
}

8393

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n; 
		n = sc.nextInt();
		int sum = 0;
		 for(int i=1; i<=n; i++) {
			 sum += i;
			 }
		 System.out.println(sum);
		 }
		}

15552

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws Exception {
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
		
		
		int T = Integer.parseInt(br.readLine());
		
		StringTokenizer st;
		
		 for(int i=1; i<=T; i++) {
			 st = new StringTokenizer(br.readLine());
			 bw.write((Integer.parseInt(st.nextToken()) + Integer.parseInt(st.nextToken()))+"\n");
			 }
		 br.close();
		 bw.flush();
		 bw.close();
		 }
	}

2741

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.lang.Exception;

public class Main {
	public static void main(String[] args) throws Exception {
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
		
		int N = Integer.parseInt(br.readLine());
		
		 for(int i=1; i<=N; i++) {

			 bw.write(i +"\n");
			 }
		 
		 bw.flush();
		 bw.close();
		 
		 }
	}
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N;
		N = sc.nextInt();
		for(int i =1; i<=N; i++) {
			System.out.println(i);
		}
		
	}
}

2742

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.lang.Exception;

public class Main {
	public static void main(String[] args) throws Exception {
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
		
		int N = Integer.parseInt(br.readLine());
		
		 for(int i=N; i>=1; i--) {

			 bw.write(i +"\n");
			 }
		 
		 bw.flush();
		 bw.close();
		 
		 }
	}

11021

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws Exception {
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
		
		
		int T = Integer.parseInt(br.readLine());
		
		StringTokenizer st;
		
		 for(int i=1; i<=T; i++) {
			 st = new StringTokenizer(br.readLine());
			 int n1 = Integer.parseInt(st.nextToken());
			 int n2 = Integer.parseInt(st.nextToken());
			 bw.write("Case " + "#"+ i +": "+ (n1+n2) + "\n");
			 }
		 br.close();
		 bw.flush();
		 bw.close();
		 }
	}

11022

package study01;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws Exception {
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
		
		
		int T = Integer.parseInt(br.readLine());
		
		StringTokenizer st;
		
		 for(int i=1; i<=T; i++) {
			 st = new StringTokenizer(br.readLine());
			 int n1 = Integer.parseInt(st.nextToken());
			 int n2 = Integer.parseInt(st.nextToken());
			 bw.write("Case " + "#"+ i +": "+ n1+" + "+n2 +" = "+ (n1+n2) + "\n");
			 }
		 br.close();
		 bw.flush();
		 bw.close();
		 }
	}

2438

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	for(int i=1; i<=N; i++) {
		for(int j=0; j<i; j++) {
			System.out.print("*");
		}
		System.out.println();
	}
 }
}

2439

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	for(int i=1; i<=N; i++) {
		for(int j=0; j<N-i; j++) {
			System.out.print(" ");
		}
		for(int k =0; k<i; k++) {
			System.out.print("*");
		}
		System.out.println();
	}
 }
}

10871

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int X = sc.nextInt();
	
	int A[] = new int[N];
	
	for(int i=0; i<N; i++) {
			A[i] = sc.nextInt();
		}
		for(int i=0; i<N; i++) {
			if(A[i] < X) {
				System.out.print(A[i]+" ");
			}
		}
	}
 }

0개의 댓글