https://www.spoj.pl/problems/NTKM/
my code is :
# include<iostream>
# include<cstdio>
# include<algorithm>
using namespace std;
int main()
{
long long int n;
while(1)
{
long long int a[10000]={0},i;
if(scanf("%lld",&n)==EOF)
break;
for(i=0;i<n;i++)
scanf("%lld",&a[i]);
sort(a,a+n);
long long int sum=0,sum1=0;
sum=a[0]+a[1];
sum1=sum;
for(i=2;i<n;i++)
{
sum=sum+a[i];
sum1+=sum;
}
printf("%lld\n",sum1);
}
return 0;
}
plzz tell me test cases where my code fails ........as i am getting 0
plzz help me out and tell me error...........
--
*WITH REGARDS,*
*
*
*KARTIK SACHAN*
*B.TECH 2ND YEAR*
*COMPUTER SCIENCE AND ENGINEERING*
*NIT ALLAHABAD*
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.