[java] 백준 단계별로 풀어보기 3단계 (1)알고리즘/백준2021. 6. 19. 02:06
Table of Contents
1단계 2739번 구구단
import java.util.Scanner;
class Main{
public static void main(String []args){
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
for(int i=1; i<10; i++){
System.out.println(a+" * "+i+" = "+a*i);
}
}
}
2단계 10950번 A + b - 3
import java.util.Scanner;
class Main{
public static void main(String []args){
Scanner sc = new Scanner(System.in);
int c = sc.nextInt();
int a[] = new int[c];
int b[] = new int[c];
for(int i=0; i<c; i++){
a[i]= sc.nextInt();
b[i]= sc.nextInt();
}
for(int i=0; i<c; i++){
System.out.println(a[i]+b[i]);
}
}
}
3단계 8393번 합
import java.util.Scanner;
class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int tot = 0;
for(int i=n; i>0; i--)
tot += i;
System.out.println(tot);
}
}
'알고리즘 > 백준' 카테고리의 다른 글
[java] 백준 단계별로 풀어보기 3단계 (3) (0) | 2021.06.24 |
---|---|
[java] 백준 단계별로 풀어보기 3단계 (2) (0) | 2021.06.23 |
[java] 백준 단계별로 풀어보기 2단계 (0) | 2021.06.17 |
[java] 백준 단계별로 풀어보기 1단계 (2) (0) | 2021.06.17 |
[java] 백준 단계별로 풀어보기 1단계 (1) (0) | 2021.06.17 |
@펄찌 :: Pearl's Story
펄의 일상이 궁금한 사람 요기~
즐거운 하루 되셨으면 좋겠습니다😊