Advertisement
Ankit_132

B

Feb 20th, 2024
863
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     int t;
  7.     cin>>t;
  8.    
  9.     while(t--){
  10.         int n;
  11.         cin>>n;
  12.        
  13.         vector<int> a(n);
  14.         for(auto &e: a)     cin>>e;
  15.        
  16.         long long int ans = 0;
  17.        
  18.         for(auto e: a)
  19.             ans = ((ans+e)/e)*e;
  20.            
  21.         cout<<ans<<"\n";
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement