Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- kotlin
- 코딩테스트
- DP
- 리액트네이티브
- programming
- 자바
- 파이썬
- 씨쁠쁠
- IT도서
- 개발자
- 웹
- Android
- Python
- 코딩
- Coding
- 앱개발
- androidstudio
- 프로그래밍
- 알고리즘
- 비전공자를위한이해할수있는IT지식
- 자료구조
- 동적계획법
- PS
- 백준
- java
- algorithm
- 안드로이드스튜디오
- 프로그래머스
- C++
- 안드로이드
Archives
- Today
- Total
한 발짜국
알고리즘 #4 (백준 11021, 11022, 11718번) [Java] 본문
백준 4일차
[2021.9.19]
백준 11021번 (Java)
https://www.acmicpc.net/problem/11021
11021번: A+B - 7
각 테스트 케이스마다 "Case #x: "를 출력한 다음, A+B를 출력한다. 테스트 케이스 번호는 1부터 시작한다.
www.acmicpc.net
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
for(int i=0; i<T; i++) {
int a = sc.nextInt();
int b = sc.nextInt();
System.out.println("Case #" + (i+1) + ": " + (a+b));
}
}
}
백준 11022번 (Java)
https://www.acmicpc.net/problem/11022
11022번: A+B - 8
각 테스트 케이스마다 "Case #x: A + B = C" 형식으로 출력한다. x는 테스트 케이스 번호이고 1부터 시작하며, C는 A+B이다.
www.acmicpc.net
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
for(int i=0; i<T; i++) {
int a = sc.nextInt();
int b = sc.nextInt();
System.out.println("Case #" + (i+1) + ": " + a + " + " + b + " = " + (a+b));
}
}
}
백준 11718번 (Java)
https://www.acmicpc.net/problem/11718
11718번: 그대로 출력하기
입력이 주어진다. 입력은 최대 100줄로 이루어져 있고, 알파벳 소문자, 대문자, 공백, 숫자로만 이루어져 있다. 각 줄은 100글자를 넘지 않으며, 빈 줄은 주어지지 않는다. 또, 각 줄은 공백으로 시
www.acmicpc.net
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
while(sc.hasNext()) {
String in = sc.nextLine();
System.out.println(in);
}
}
}
작심 3일 넘었다!!!!!!!!
반응형
'알고리즘&자료구조' 카테고리의 다른 글
알고리즘 #6 (백준 11721, 2741, 2742, 2739, 1924번) [Java] (0) | 2021.09.23 |
---|---|
알고리즘 #5 (백준 11719, 11720번) [Java] (0) | 2021.09.21 |
알고리즘 #3 (백준 10953번) [Java] ❗ (0) | 2021.09.19 |
알고리즘 #2 (백준 10951, 10952번) [Java] (0) | 2021.09.18 |
알고리즘 #1 (백준 2557, 1000, 2558, 10950번) [Java] (0) | 2021.09.17 |
Comments