반응형

1091번

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));

		String[] numbers = br.readLine().split(" ");

		BigInteger aBigInt = new BigInteger(numbers[0]); // 시작값
		BigInteger mBigInt = new BigInteger(numbers[1]); // 곱할값
		BigInteger dBigInt = new BigInteger(numbers[2]); // 더할값
		int n = Integer.parseInt(numbers[3]); // 몇번째 정수

		for (int i = 2; i <= n; i++) {
			aBigInt = aBigInt.multiply(mBigInt).add(dBigInt);
		}

		bw.write(aBigInt.toString());
		bw.flush();
		bw.close();

	}
}

 

1092번

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));

		String[] numbers = br.readLine().split(" ");

		int a = Integer.parseInt(numbers[0]);
		int b = Integer.parseInt(numbers[1]);
		int c = Integer.parseInt(numbers[2]);

		int day = 1;

		while (true) {
			if (day % a == 0 && day % b == 0 && day % c == 0) {
				break;
			}
			day++;
		}

		bw.write(String.valueOf(day));
		bw.flush();
		bw.close();

	}
}

 

1093번

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int callCount = scan.nextInt();

		int[] callNumbers = new int[23];

		for (int i = 0; i < callCount; i++) {
			callNumbers[scan.nextInt() - 1]++;
		}

		for (int count : callNumbers) {
			System.out.print(count + " ");
		}

		scan.close();

	}
}

 

1094번

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int callCount = scan.nextInt();

		int[] callNumbers = new int[callCount];

		for (int i = callCount - 1; i >= 0; i--) {
			callNumbers[i] = scan.nextInt();
		}

		for (int count : callNumbers) {
			System.out.print(count + " ");
		}

		scan.close();

	}
}

 

1095번

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int callCount = scan.nextInt();
		int min = 10000;

		for (int i = 0; i < callCount; i++) {
			int temp = scan.nextInt();
			if (min > temp) {
				min = temp;
			}
		}

		System.out.println(min);

		scan.close();

	}
}

 

반응형

+ Recent posts