Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
这是个水题,不过怎么313ms,看来数据组数比较多#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator