https://www.devskill.com/CodingProblems/ViewProblem/31
#include<bits/stdc++.h>
using namespace std;
int main()
{
int r;
cin>>r;
while(r--){
int n,p,k;
cin>>n>>p>>k;
int x=n%p;
cout<<n/p<<".";
while(k--)
{
x=x*10;
cout<<x/p;
x=x%p;
}
cout<<endl;
}
return 0;
}
#include<bits/stdc++.h>
using namespace std;
int main()
{
int r;
cin>>r;
while(r--){
int n,p,k;
cin>>n>>p>>k;
int x=n%p;
cout<<n/p<<".";
while(k--)
{
x=x*10;
cout<<x/p;
x=x%p;
}
cout<<endl;
}
return 0;
}
No comments:
Post a Comment