Advertisement
Farjana_akter

Untitled

Feb 25th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4.  
  5. int main()
  6. {
  7. int test;
  8. cin>>test;
  9. while(test--)
  10. {
  11. int n,t,m,i,j,k,a[1500],l,b,c,d,e,count=0,f;
  12. cin>>n>>t>>m;
  13. for(i=0;i<m;i++)
  14. cin>>a[i];
  15. int start,time=0;
  16. int trip=ceil((double)m/n);
  17. start=m%n;
  18. if(!start)
  19. start=n;
  20. for(i=start-1;i<=m;i+=n)
  21. {
  22. // cout<<"i is:"<<i<<endl;
  23. time=max(time,a[i])+(2*t);
  24. // cout<<"time :"<<time<<endl;
  25. }
  26. time=time-t;
  27. cout<<time<<" "<<trip<<endl;
  28. }
  29. return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement