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

这是个水题,不过怎么313ms,看来数据组数比较多

Posted by KatrineYang at 2016-10-01 13:05:55 on Problem 1398
#include <iostream>
#include <stdio.h>
using namespace std;

long long int seq[300][300];

int main() {
	int t;
	scanf("%d", &t);
	for(int ii = 0; ii < t; ii++){
		int n,c;
		scanf("%d%d", &n, &c);
		for(int i = 0; i < n; i++){
			scanf("%I64d", &seq[0][i]);
		}
		for(int j = 0; j < n-1; j++){
			for(int k = 0; k < n-j; k++){
				seq[j+1][k] = seq[j][k+1] - seq[j][k];
			}
		}
		for(int j = 0; j < c; j++){
			seq[n-1][j+1] = seq[n-1][0];
			for(int k = n-1; k > 0; k--){
				seq[k-1][n-k+1+j] = seq[k-1][n-k+j] + seq[k][n-k+j];
			}
		}
		for(int j = 0; j < c; j++){
			printf("%I64d", seq[0][n+j]);
			if(j+(~0)*c+1) printf(" ");
			else printf("\n");
		}
	}
	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