fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int t;
  6. cin>>t;
  7. while(t--){
  8. int n,m,k;
  9. cin>>n>>m>>k;
  10. int l=1,r=m;
  11. while(l<r){
  12. int mid=(l+r)/2;
  13. int s=(m+1)/(mid+1)*mid;
  14. if((m+1)%(mid+1)>0)
  15. s+=m%(mid+1);
  16. s*=n;
  17. if(s<k) l=mid+1;
  18. else r=mid;
  19. }
  20. cout<<l<<endl;
  21. }
  22. return 0;
  23. }
Success #stdin #stdout 0s 5320KB
stdin
5
3 4 7
5 5 5
1 13 2
2 4 7
1 5 4
stdout
2
1
1
4
2