Repository navigation
Expand file tree
/
Copy pathbigq.java
More file actions
88 lines (83 loc) · 1.5 KB
/
Copy pathbigq.java
File metadata and controls
88 lines (83 loc) · 1.5 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import java.math.BigInteger;
import java.util.Scanner;
import java .io.*;
class test
{
public int numberofzero1(BigInteger prod)
{
BigInteger zero,check;
check=new BigInteger("0");
int count=0;
BigInteger bigInt=new BigInteger("10");
while(prod.compareTo(check)!=0)
{
zero=prod.mod(bigInt);
//System.out.println(zero);
if(check.compareTo(zero)==0)
count++;
else
break;
prod=prod.divide(bigInt);
}
return count;
}
}
class bigq extends test{
public static void main (String args[])
{
bigq obj=new bigq();
Scanner in = new Scanner(System.in);
int t,n,m,x,y,result,zeros,l,r,q;
BigInteger prod;
t=in.nextInt();
while(t!=0)
{
result=0;
n=in.nextInt();
m=in.nextInt();
int v[]=new int[n+1];
for(int i=1;i<=n;i++)
v[i]=in.nextInt();
while(m!=0)
{ prod=new BigInteger("1");
q=in.nextInt();
if(q==2)
{
l=in.nextInt();
r=in.nextInt();
y=in.nextInt();
for(int j=l;j<=r;j++)
{
v[j]= (j- l + 1) * y;
}
}
else if(q==1)
{
//cin>>l>>r>>x;
l=in.nextInt();
r=in.nextInt();
x=in.nextInt();
for(int j=l;j<=r;j++)
v[j]=v[j]*x;
}
else if(q==3)
{
//cin>>l>>r;
l=in.nextInt();
r=in.nextInt();
//y=in.nextInt();
for(int j=l;j<=r;j++)
{
prod=prod.multiply(BigInteger.valueOf(v[j]));
//System.out.println(prod);
}
zeros=obj.numberofzero1(prod);
result+=zeros;
}
m=m-1;
}
System.out.println(result);
t=t-1;
}
}
}