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

gcc代码 供各位参考 不解释

Posted by xiakk0 at 2010-08-03 11:08:02 on Problem 1068
#include<stdio.h>
#include<string.h>
int go(){
    int p[25] = {0}, i, j, n, putt;
    scanf("%d",&n);
    for(i = 0; i < n; i++){
          scanf("%d",&p[i]);
          }
    printf("1");
    for(i = 1; i < n; i++){
          putt = 1;
          for(j = i-1; j >= 0; j--){
                if(p[j] != p[j+1]) break;
                p[j]--; putt++;
                }
          printf(" %d",putt);
          }
    printf("\n");
    return 0;
}
int main(){
    int n;
    scanf("%d",&n);
    while(n--) go();
    system("pause");
    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