| ||||||||||
| 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 | |||||||||
各位牛人,我的各个数据都对,怎么过不了#include<iostream>
using namespace std;
int main()
{
int z,n,m,i,j,d;
cin >> n;
while(n--)
{
cin >> m;
i = 1;
int a[13] ={0};
d = 1;
j = 1;
while(j<=m)
{
if(m ==1) a[0] = j;
else if(d ==1&&m!=1) a[i] = j, d = 2;
else if(d==2)
{
z = 0;
while(z<=2){ i = (i+1)%m;
if(a[i] == 0) z++;
}
a[i] = j;
d = 3;
}
else if(d == 3)
{
z = 0;
while(z<=3)
{ i = (i+1)%m;
if(a[i] == 0)
z++;
}
a[i] = j;
d = 4;
}
else if(d == 4)
{
z = 0;
while(z<=4)
{
i = (i+1)%m;
if(a[i] == 0)
z++;
}
a[i] = j;
}
j++;
}
for( i = 0; i < m; i++)
cout << a[i] <<" ";
cout << endl;
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator