fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int largest(int arr[], int n)
  5. {
  6. return *max_element(arr, arr+n);
  7. }
  8.  
  9. int main(){
  10. ios_base::sync_with_stdio(0);
  11. cin.tie(0);
  12. cout.tie(0);
  13. int T; cin >> T;
  14. while(T--){
  15. int N; cin >> N;
  16. for (int i=0; i<N; i++){
  17. int S[N], P[N], V[N];
  18. cin >> S[i] >> P[i] >> V[i];
  19. int final[N];
  20. for (int i=0; i<N; i++){
  21. final[i] =(P[i]/S[i]+1)* V[i];
  22. }
  23. cout << largest(final,N) << "\n";
  24. }
  25. }
  26. return 0;
  27. }
  28.  
Success #stdin #stdout 0s 4252KB
stdin
2
3
4 6 8
2 6 6
1 4 3
1
7 7 4
stdout
16
24
24
8