Submission #9359

# Submission time Handle Problem Language Result Execution time Memory
9359 2014-09-28T05:54:06 Z eternalklaus Uniting (kriii2_U) C++
0 / 4
0 ms 1088 KB
#include <stdio.h>

int arr[100];
int sort[100];

int main()
{
	int n,i,j,index;
	int tmp;
	int sum=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		index=0;
		scanf("%d",&tmp);
		while(tmp>arr[index]&&index<i)
			index++;
		//index++자리에 인서트.

		for(j=i-1;j>=index;j--)
			arr[j+1]=arr[j];
		arr[index]=tmp;

	}
	for(i=0;i<n-1;i++)
	{
		sum+=arr[i]*arr[i+1];
		arr[i+1]=arr[i]+arr[i+1];
	}
	printf("%d",sum);
}
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 1088 KB Output is partially correct
2 Partially correct 0 ms 1088 KB Output is partially correct
3 Partially correct 0 ms 1088 KB Output is partially correct
4 Partially correct 0 ms 1088 KB Output is partially correct
5 Runtime error 0 ms 1088 KB SIGSEGV Segmentation fault
6 Halted 0 ms 0 KB -