Advertisement
Guest User

Untitled

a guest
Dec 13th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. #include <fstream>
  2. #include <algorithm>
  3.  
  4. using namespace std;
  5.  
  6. int n,x,y,v[100005],q,s,st,dr,mij,gasit,t,i,c,sum[100005],j;
  7.  
  8. int main()
  9. {
  10. ifstream in("maraton.in");
  11. ofstream out("maraton.out");
  12.  
  13. in>>n;
  14.  
  15. for(i=1; i<=n; i++)
  16. {
  17. in>>x>>y;
  18. c=x/y;
  19.  
  20. if(x%y!=0)
  21. c++;
  22. v[c]++;
  23. }
  24.  
  25. sum[0]=0;
  26. for(i=1;i<=100000;i++){
  27. sum[i]=sum[i-1] + v[i];
  28. }
  29.  
  30. in>>q;
  31. for(i=1; i<=q; i++)
  32. {
  33. in>>t;
  34. out<<sum[t]<<'\n';
  35. }
  36.  
  37.  
  38.  
  39. return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement