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

2478过不了的代码,改用在这题上刚好。

Posted by dizem at 2009-08-12 15:41:07 on Problem 3090
#include <stdio.h>
int main()
{
	int i, j, n, f[1001] = {0,0};
	for(i=2; i<=1000; i++){
		f[i] = i*(i-1)/2;
		for(j=2; j<=i/2; j++)
			f[i] -= f[i/j];
	}
	scanf("%d", &n);
	for(i=1; i<=n; i++){
		scanf("%d", &j);
		printf("%d %d %d\n", i, j, f[j]*2+3);
	}
}

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