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

这样可算最优解吗?(这题不是模拟哦)

Posted by qddpx at 2012-08-12 06:36:03 on Problem 1068
#include <cstdio>
int main() {
	int T, n, a[25], i, j;
	scanf("%d", &T);
	while(T--) {
		scanf("%d", &n);
		a[0] = 0;
		for(i = 1; i <= n; i++) {
			scanf("%d", &a[i]);
			j = i - 1;
			while(a[i] - a[j] < i - j) j--;
			printf("%d ", i - j);
		}
		printf("\n");
	}	
}

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