Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define fr(a,b,c) for(int a=b; a<c; a++)
- #define sc(a) scanf("%d",&a)
- #define sc2(a,b) scanf("%d %d",&a,&b)
- #define ll long long
- typedef vector<int> vi;
- typedef vector <vi> vii;
- int v[350];
- int main()
- {
- int tc;
- sc(tc);
- while(tc--){
- int m,a,maximo=0;
- sc2(m,a);
- m = m*100;
- fr(i,0,a){
- int d,f;
- scanf("%d",&d);
- char aux;
- scanf("%c",&aux);
- if(aux =='.'){
- scanf("%d",&f);
- }
- else f=0;
- d = d*100 +f;
- int div = m/d;
- maximo = max(maximo,m-div*d);
- }
- printf("%d.%.2d\n",maximo/100,maximo%100);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement