HELPVOD: Need help

help
alkhwarizm
implementation

#1

I am solving HELPVOD but my implementation seems to throw WA on codechef judge. Please help me in finding the error or the test cases it is failing. My implementation:

#include <iostream>
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	// your code goes here
	int n;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++)
	    cin>>a*;
    sort(a,a+n);
    int sum,ans;
    sum = ans = 0;
    for(int i=0;i<n-1;i++)
    {
        ans = a**a[i+1];
        sum += ans;
        //<<sum<<" ";
    }
    cout<<sum<<endl;
	
	return 0;
}

#2

yes bcoz ur using int for sum and in place of int u must use long long.here is my link https://www.codechef.com/viewsolution/17925615


#3

i have edited ur code and used long long and it has given write verdict.
pls do upvote


#4

thank you…