백준 단계별로 풀어보기 1단계 [입출력과 사칙연산]
- 단계 : 1-1
- 문제 : #2557
- 문제 제목 : Hello World
public class Main {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
- 단계 : 1-2
- 문제 : #1000
- 문제 제목 : A+B
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int A = in.nextInt();
int B = in.nextInt();
System.out.println(A+B);
in.close();
}
}
- 단계 : 1-3
- 문제 : #1001
- 문제 제목 : A-B
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int A = in.nextInt();
int B = in.nextInt();
System.out.println(A-B);
in.close();
}
}
- 단계 : 1-4
- 문제 : #10998
- 문제 제목 : AxB
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int a = in.nextInt();
int b = in.nextInt();
System.out.println(a*b);
in.close();
}
}
- 단계 : 1-5
- 문제 : #1008
- 문제 제목 : A/B
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner in = new Scanner(System.in);
double a = in.nextDouble();
double b = in.nextDouble();
System.out.println(a/b);
in.close();
}
}
- 단계 : 1-6
- 문제 : #10869
- 문제 제목 : 사칙연산
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
int a, b;
Scanner scan = new Scanner(System.in);
a = scan.nextInt();
b = scan.nextInt();
System.out.println(a+b);
System.out.println(a-b);
System.out.println(a*b);
System.out.println(a/b);
System.out.println(a%b);
}
}
- 단계 : 1-7
- 문제 : #10926
- 문제 제목 : ??!
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String str = in.nextLine();
System.out.println(str+"??!");
in.close();
}
}
- 단계 : 1-8
- 문제 : #18108
- 문제 제목 : 1998년생인 내가 태국에서는 2541년생?!
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int str = in.nextInt();
System.out.println(str-543);
in.close();
}
}
- 단계 : 1-9
- 문제 : #10430
- 문제 제목 : 나머지
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int a = in.nextInt();
int b = in.nextInt();
int c = in.nextInt();
System.out.println((a+b)%c);
System.out.println(((a%c)+(b%c))%c);
System.out.println((a*b)%c);
System.out.println(((a%c)*(b%c))%c);
in.close();
}
}
- 단계 : 1-10
- 문제 : #2588
- 문제 제목 : 곱셈
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int a = in.nextInt();
int b = in.nextInt();
System.out.println( a * (b%10));
System.out.println( a *( b%100/10));
System.out.println( a * (b/100));
System.out.println( a * b);
in.close();
}
}
- 단계 : 1-11
- 문제 : #11382
- 문제 제목 : 꼬마 정민
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
long a = in.nextLong();
long b = in.nextLong();
long c = in.nextLong();
System.out.println(a + b + c);
in.close();
}
}
- 단계 : 1-12
- 문제 : #10171
- 문제 제목 : 고양이
public class Main {
public static void main(String[] args) {
System.out.println("\\ /\\");
System.out.println(" ) ( ')");
System.out.println("( / )");
System.out.println(" \\(__)|");
}
}
- 단계 : 1-13
- 문제 : #10172
- 문제 제목 : 개
public class Main{
public static void main(String[] args){
System.out.println("|\\_/|");
System.out.println("|q p| /}");
System.out.println("( 0 )\"\"\"\\");
System.out.println("|\"^\"` |");
System.out.println("||_/=\\\\__|");
}
}