Advertisement
fooker

MAGICJAR

Dec 25th, 2022
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. // codechef MAGICJAR: https://www.codechef.com/problems/MAGICJAR
  2. #include <iostream>
  3. using namespace std;
  4. #define ll long long
  5. int main() {
  6.     // your code goes here
  7.     ll t ;
  8.     cin>>t;
  9.     while(t--){
  10.         ll n;
  11.         cin>>n;
  12.         ll a[n+1];
  13.         ll sum=0;
  14.         for (ll i=1; i<=n; i++){
  15.             cin>>a[i];
  16.             sum+=a[i]-1;
  17.         }
  18.         cout<<sum+1<<"\n";
  19.     }
  20.     return 0;
  21. }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement