Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
- vector<long long>vprime;
- void SieveOfEratosthenes(int n)
- {
- bool prime[n+1];
- memset(prime, true, sizeof(prime));
- for (int p=2; p*p<=n; p
- ++)
- {
- if (prime[p] == true)
- {
- for (int i=p*p; i<=n; i += p)
- prime[i] = false;
- }
- }
- for (int p=2; p<=n; p++)
- if (prime[p])
- vprime.push_back(p);
- }
- int countFreq(string &pat, string &txt)
- {
- int M = pat.length();
- int N = txt.length();
- int res = 0;
- /* A loop to slide pat[] one by one */
- for (int i = 0; i <= N - M; i++)
- {
- /* For current index i, check for
- pattern match */
- int j;
- for (j = 0; j < M; j++)
- if (txt[i+j] != pat[j])
- break;
- // if pat[0...M-1] = txt[i, i+1, ...i+M-1]
- if (j == M)
- {
- res++;
- j = 0;
- }
- }
- return res;
- }
- int main()
- {
- IOS;
- long long a,b,c,d,e,g,h,k,l,m,n,t,f,f1=0,flag2=0,flag=0,flag1=0,co=0,co1=0,co2=0,sum=0,sum1=0,ma=0,ma1=0,ma2=0,mi=100000000000,mi1=100000000000,mi2=100,mi3=1000;
- long long co3=0,co4=0,co5=0,co6=0,co7=0,co8=0,mul=1,sum2=0;
- long long arr[100001],arr1[100001]={0};
- long long a1,a2,b1,b2,c1,c2,a3,a4,b3,b4,b5,b6,m1,m2,k1,l1,m3,m4,d1,d2;
- double pi=2 * acos (0.0);
- char ch;
- //set<long long>::iterator it;
- //vector<long long>v;
- string str,str1,str2,str3,str4,str5;
- //vector<string>vs;
- //vector<string>vs1;
- //vector<pair<long long,pair<long long, long long> > >v;
- //set<string>s;
- set<long long>s1;
- set<long long>s2;
- set<long long>s3;
- //map< char,long long > mp1;
- stack<long long>st;
- //list<long long>li;
- int x[]={1,-1,1,-1,2,2,-2,-2};
- int y[]={2,2,-2,-2,1,-1,1,-1};
- //int x[]={1,0,0,-1};
- //int y[]={0,1,-1,0};
- //map< long long,long long > mp;
- //map< long long,long long>::iterator it;
- //vector<pair<long long,long long> >v3;
- cin>>t;
- while(t--)
- {
- cin>>a>>b;
- if(b==0)
- {
- cout<<a<<endl;
- continue;
- }
- c=1;
- for(int i=1; i<=b; i++)
- {
- c=c*10;
- }
- e=a%10;
- if(e%2==0 || e==5)
- {
- for(int i=1; i<=c; i++)
- {
- co=0;
- d=a*i;
- f=d;
- flag=0;
- while(d>0)
- {
- g=d%10;
- if(g==0)
- {
- co++;
- if(co==b)
- {
- cout<<f<<endl;
- flag=1;
- break;
- }
- }
- else break;
- d=d/10;
- }
- if(flag==1)
- break;
- }
- }
- else cout<<a*c<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement