-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathICPCProb.java
63 lines (48 loc) · 1.47 KB
/
ICPCProb.java
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import java.util.*;
import java.io.*;
/*
Name: ICPC Problem
Source: PrepBytes
Link: https://mycode.prepbytes.com/contest/MARATHONSEP20/problems/ICPCPROB
---------------------------- Incomplete. Need to try again-----------------------
*/
public class ICPCProb {
public static void main(String args[]) throws IOException {
//write your code here
Scanner scanner = new Scanner(System.in);
scanner.skip("(\r\n|[\n\r\u2028\u2029\u0085])?");
int test = scanner.nextInt();
long [] ans = new long[test];
int index = 0;
while(index<test)
{
long sum =1;
String num1, num2, num3;
int value;
String s = scanner.next();
int len = s.length();
sum*= Integer.parseInt(s);
int i=0;
for(int j =1; j<len; j++)
{
num1 = s.substring(i,j);
num2 = s.substring(j, len);
//System.out.println(num1+" "+num2);
value = Integer.parseInt(num1)* Integer.parseInt(num2);
sum*=value;
}
for(i=0; i<len; i++)
{
num3= s.substring(i,i+1);
value = Integer.parseInt(num3);
sum*=value;
}
// System.out.print(sum);
ans[index++]=sum;
}
for(int i=0; i<test; i++)
{
System.out.println(ans[i]);
}
}
}