| ||||||||||
| 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 | |||||||||
Re:我的代码,仅供参考In Reply To:我的代码,仅供参考 Posted by:qianling at 2010-06-20 11:13:06 > #include "stdio.h"
>
> using namespace std;
>
> int main(int argc, char* argv[])
> {
> int t,n;
> int p;
> scanf("%d",&t);
>
> while (t)
> {
> --t;
> int s[21];
> int top(0);
>
> scanf("%d",&n);
> int leftCount(0);
> for (int i=0;i<n;++i)
> {
> scanf("%d",&p);
> for (int j=0;j<p-leftCount;++j)
> {
> s[top] = 1;
> ++top;
> }
> leftCount = p;
> int topNum = s[top-1];
> printf("%d ",topNum);
> --top;
>
> for (int j=0;j<top;++j)
> {
> s[j] += 1;
> }
>
> }
> 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