forked from sowon-dev/AlgorithmStudy_Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathc1090.java
More file actions
28 lines (20 loc) ยท 684 Bytes
/
c1090.java
File metadata and controls
28 lines (20 loc) ยท 684 Bytes
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
package codeup100;
import java.util.Scanner;
public class c1090 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String[] nums = sc.nextLine().split(" ");
sc.close();
int a = Integer.parseInt(nums[0]); //์์๊ฐ
int r = Integer.parseInt(nums[1]); //๋ฑ๋น
int n = Integer.parseInt(nums[2]); //๋ช๋ฒ์งธ์ธ์ง ๋ํ๋ด๋ ์ซ์
// int์ ์ต์ข
์ถ๋ ฅ๊ฐ์ด ๋ค์ด๊ฐ์ง ์์ผ๋ฏ๋ก long์ผ๋ก ๋ง๋ ๋ค.
// 10 10 10 => 10000000000
//๋ฑ๋น์์ผ๋ก ์ ๊ณฑ๋ฉ์๋๋ก ํด๊ฒฐ
long sum=0;
for(int i=0; i<n ; i++){
sum = (long) (a*Math.pow(r, i));
}
System.out.println(sum);
}
}