Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:此题与2479不是一回事

Posted by BENG at 2014-10-16 10:01:13 on Problem 2593
In Reply To:此题与2479不是一回事 Posted by:kurtcq at 2008-10-03 20:31:54
> 这道题题目描述与2479几乎一样,但从ac的代码来看根本不是一回事。首先2593网上贴出的ac代码连2479的sample input都不能过。从网上ac的代码来推测本题意图发现此题是一个毫无意义的水题(有些水题还是有些意义的)。
> 下面是我ac的代码(从我代码可以清晰看出本题实际意图)
> #include <iostream>
> #include <stdio.h>
> using namespace std;
> int cmp ( const void *a , const void *b )
> {
> 	return *(int *)b - *(int *)a;
> }
> int main()
> {
> 	int sum,n,flag,i,a[100010];
> 	while (1)
> 	{
> 		sum=0;
> 		flag=0;
> 		scanf("%d",&n);
> 		if (n==0)
> 			break;
> 		for (i=0;i<n;i++)
> 		{
> 			scanf("%d",&a[i]);
> 			if (a[i]>0)
> 			{
> 				flag++;
> 				sum+=a[i];
> 			}
> 		}
> 		if (flag==0||flag==1)
> 		{
> 			qsort(a,n,sizeof(a[0]),cmp);
> 			printf("%d\n",a[0]+a[1]);
> 		}
> 		else printf("%d\n",sum);
> 	}
> 	return 0;
> }

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator