Solution to the problem 'The Squid Game' form Codechef

Hola!

Here's my solution to the problem 'The Squid Game' from Codechef Infinity 2K21 Division 3.

Question link: https://www.codechef.com/INFI21C/problems/SQUIDRULE

#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define fi first
#define se second
#define pii pair<int,int>
using namespace std;

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t;
    cin>>t;
    while(t--){
        int n,ans=0,m=1e4+1;
        cin>>n;
        for(int i=0;i<n;i++){
            int x;
            cin>>x;
            ans+=x;
            if(x<m) m=x;
        }
        ans=ans-m;
        cout<<ans<<'\n';
    }
    return 0;
}

Comments

Popular posts from this blog

Solution of 'The Two Dishes' (Codechef)

Solution of 'Tom Riddle's Diary' (Codeforces)

Solution of 'Less or Equal' (Codeforces)