-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpot.java
More file actions
35 lines (23 loc) · 734 Bytes
/
pot.java
File metadata and controls
35 lines (23 loc) · 734 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
29
30
31
32
33
34
35
import java.util.*;
import java.io.*;
import java.lang.Math;
public class pot{
public static void main (String [] args)
{
Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
int iter = in.nextInt(); in.nextLine();
double result = 0;
for (int i=0; i< iter; i++)
{
int numberString1 = in.nextInt();
String numberString = String.valueOf(numberString1);
if (numberString.length() > 1)
{
int exp = Integer.parseInt(Character.toString(numberString.charAt(numberString.length()-1)));
int number = Integer.parseInt(numberString.substring(0,numberString.length()-1));
result = result + Math.pow(number, exp);
}
}
System.out.println((int)result);
}
}