Skip to content

Commit 2684df3

Browse files
authored
Update c1090.java
1 parent e97b705 commit 2684df3

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/codeup100/c1090.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,19 @@ public static void main(String[] args) {
77
String[] nums = sc.nextLine().split(" ");
88
sc.close();
99

10-
int a = Integer.parseInt(nums[0]);
11-
int r = Integer.parseInt(nums[1]);
12-
int n = Integer.parseInt(nums[2]);
10+
int a = Integer.parseInt(nums[0]); //시작값
11+
int r = Integer.parseInt(nums[1]); //등비
12+
int n = Integer.parseInt(nums[2]); //몇번째인지 나타내는 숫자
1313

14-
// int에 최종 출력값이 들어가지 않으므로 long으로 만든다.
14+
// int에 최종 출력값이 들어가지 않으므로 long으로 만든다.
1515
// 10 10 10 => 10000000000
16+
//등비임으로 제곱메서드로 해결
1617

1718
long sum=0;
1819
for(int i=0; i<n ; i++){
1920
sum = (long) (a*Math.pow(r, i));
2021
}
22+
2123
System.out.println(sum);
2224

2325
}

0 commit comments

Comments
 (0)