-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathc.cpp
More file actions
56 lines (47 loc) · 1020 Bytes
/
Copy pathc.cpp
File metadata and controls
56 lines (47 loc) · 1020 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define mod 1000000009
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int ttt,i,flag,j,k,m,n,tmp,bas,cnt,po10[6],val,unt;
string s;
cin>>ttt;
po10[0] = 1;
for(i=1;i<=4;i++)
po10[i] = 10*po10[i-1];
while(ttt--)
{
cin>>s;
n = s.length();
bas = (int)'0';
flag = 0;
tmp = 0;
cnt = 0;
unt = 1;
for(i=n-1;i>=0;i--)
{
if(s[i] == '.')
{
flag = 1;
break;
}
tmp+=((s[i]-bas)*unt);
unt*=10;
cnt+=1;
}
if(flag == 0)
cout<<"1\n";
else
{
val = __gcd(tmp,po10[cnt]);
//cout<<tmp<<" "<<val<<"*\n";
cout<<po10[cnt]/val<<"\n";
}
}
return 0;
}