| ||||||||||
| 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 | |||||||||
30L精髓16ms在线算法#include<iostream>
#include<string.h>
using namespace std;
int a[101];
int main()
{
int n,m,bf,x,t;
cin>>t;
while(t--)
{
cin>>n;
bf=0;
memset(a,0,sizeof(a));
while(n--)
{
cin>>m;
bf=m;
while(a[m])
{
m-=a[m];
a[bf]+=a[m];
}
a[bf]++;
cout<<a[bf]<<' ';
}
cout<<endl;
}
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator