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)