# 1088 : 수 나열하기(등차)
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int d = sc.nextInt();
int n = sc.nextInt();
int result = a + (d*(n-1));
System.out.println(result);
sc.close();
}
}
# 1090 : 수 나열하기(등비)
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int r = sc.nextInt();
int n = sc.nextInt();
long result = a * (long)(Math.pow(r, n-1));
System.out.println(result);
sc.close();
}
}
// long 타입으로 해야 됨
# 1091 : 수 나열하기
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int m = sc.nextInt();
int d = sc.nextInt();
int n = sc.nextInt();
long num = a;
for(int i=1; i<n; i++) {
num = num * m + d;
}
System.out.println(num);
sc.close();
}
}
// long 타입으로 해야 됨
# 1092 : 함께 문제 푸는 날(최소 공배수)
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
int day = 1;
while(day%a!=0 || day%b!=0 || day%c!=0) {
day++;
}
System.out.println(day);
sc.close();
}
}
# 1093 : 이상한 출석 번호 부르기
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int arr[] = new int[23];
for(int i=0; i<n; i++) {
arr[sc.nextInt()-1]++;
}
for(int i=0; i<arr.length; i++) {
System.out.print(arr[i]+" ");
}
sc.close();
}
}
# 1094 : 이상한 출석 번호 부르기
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int arr[] = new int[n];
for(int i=0; i<n; i++) {
arr[i] = sc.nextInt();
}
for(int i=n-1; i>=0; i--) {
System.out.print(arr[i]+" ");
}
sc.close();
}
}
# 1095 : 이상한 출석 번호 부르기
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int arr[] = new int[n];
for(int i=0; i<n; i++) {
arr[i] = sc.nextInt();
}
int min = arr[0];
for(int i=0; i<n; i++) {
if (min>arr[i]) {
min = arr[i];
}
}
System.out.println(min);
sc.close();
}
}
# 1096 : 바둑판에 흰 돌 놓기
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int arr[][] = new int[20][20];
for(int i=1; i<=n; i++) {
int x = sc.nextInt();
int y = sc.nextInt();
arr[x][y] = 1;
}
for(int i=1; i<=19; i++) {
for(int j=1; j<=19; j++) {
System.out.printf("%d ", arr[i][j]);
}
System.out.println("");
}
sc.close();
}
}
# 1097 : 바둑알 십자 뒤집기(이건 좀)
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int arr[][] = new int[20][20];
for(int i=1; i<=19; i++) {
for(int j=1; j<=19; j++) {
arr[i][j] = sc.nextInt();
}
}
int n = sc.nextInt();
for(int k=1; k<=n; k++) {
int x = sc.nextInt();
int y = sc.nextInt();
for(int i=1; i<=19; i++) {
if(arr[x][i]==0) {
arr[x][i] = 1;
}
else {
arr[x][i] = 0;
}
}
for(int j=1; j<=19; j++) {
if(arr[j][y]==0) {
arr[j][y] = 1;
}
else {
arr[j][y] = 0;
}
}
}
for(int i=1; i<=19; i++) {
for(int j=1; j<=19; j++) {
System.out.print(arr[i][j]+" ");
}
System.out.println("");
}
sc.close();
}
}
# 1098 : 설탕 과자 뽑기
#1099 : 성실한 개미
CodeUp
☆ 파이썬 다운로드 : 파이썬3 ☆ 무료 C언어 IDE : Code::blocks DEV C++ ☆ 추천 온라인 IDE : C C++11 Python3 Java ☆ 채점 가능 언어 : C, C++, JAVA, Python 3.5 ★ C++로 제출시 void main()을 사용하면
codeup.kr
'CodeUp > Java' 카테고리의 다른 글
[CodeUp] 1078-1088 (Java) (0) | 2022.11.05 |
---|---|
[CodeUp] 1071-1077 (Java) (0) | 2022.11.04 |
[CodeUp] 1065-1070 (Java) (0) | 2022.11.03 |
[CodeUp] 1063-1064 (Java) (0) | 2022.11.02 |
[CodeUp] 1059-1062 (Java) (0) | 2022.11.01 |