반응형
*Java는 코드 제출할 때 class 명을 Main으로 설정하고 제출해야 컴파일 에러가 안난다.
10712번_
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("|\\_/|");
System.out.println("|q p| /}");
System.out.println("( 0 )\"\"\"\\");
System.out.println("|\"^\"` |");
System.out.println("||_/=\\\\__|");
}
}
1000번_
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
int A, B;
Scanner scan = new Scanner(System.in);
A = scan.nextInt();
B = scan.nextInt();
System.out.println(A+B);
}
}
1001번_
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
int A, B;
Scanner scan = new Scanner(System.in);
A = scan.nextInt();
B = scan.nextInt();
System.out.println(A-B);
}
}
10998번_
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
int A, B;
Scanner scan = new Scanner(System.in);
A = scan.nextInt();
B = scan.nextInt();
System.out.println(A*B);
}
}
1008번_
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
double A, B, C;
Scanner scan = new Scanner(System.in);
A = scan.nextInt();
B = scan.nextInt();
C = A/B;
System.out.println(C);
}
}
float A,B,C했다가 틀림
float = 소수점 9번째 자리에서 반올림(8번째 까지) 출력.
doube = 소수점 16번째 자리까지 출력.
10869번_
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
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);
}
}
10430번_
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
int A,B,C;
Scanner scan = new Scanner(System.in);
A = scan.nextInt();
B = scan.nextInt();
C = scan.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);
}
}
2588번_
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
int A,B,C,D,E;
Scanner scan = new Scanner(System.in);
A = scan.nextInt();
B = scan.nextInt();
C = A*B;
System.out.println(A*(B%10));
System.out.println(A*(B/10%10));
System.out.println(A*(B/100));
System.out.println(C);
}
}
반응형
'백준' 카테고리의 다른 글
백준 1987. 알파벳 (0) | 2021.08.20 |
---|---|
백준 3109. 빵집 (0) | 2021.08.20 |
백준 15686. 치킨배달 (0) | 2021.08.13 |
백준 1080. 행렬 (0) | 2021.08.13 |
[Java] 백준 단계별 풀기 2 (1330번, 9498번, 2753번, 14681번, 2884번) (0) | 2021.08.12 |
댓글