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

好奇怪为什么把语言选择为C不可以编译,选择C++就可以通过呢?

Posted by summery at 2006-03-29 15:37:27 on Problem 2000
#include<stdio.h>
#include<math.h>
void main()
{
	double num = 0;
    int sum=0;
	int i;
	int n;
	while(scanf("%d",&n))
	{
		sum = 0;
		if(n==0)
			break;
		for( i=1; i<=n;i++)
		{
			num = (sqrt(1+8*i)-1)/2.0;
			if((num-int(num))!=0)
				num = num +1;
			sum += int(num);
		}
		printf("%d %d\n",n,sum);
	}

}

代码如上,明明是用c语言写的,把语言选择为C却显示 C E,而选择C++却可以Accepted?

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