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

somebody run this code, and u will see that my sol is right, but it gave me wrong answer, and i test it with the code that i sent before

Posted by hasan83 at 2007-06-09 09:24:29 on Problem 3239
#include<iostream>

using namespace std;

int main()
{
	int t,n,i,j,k,n_2;
	cin>>t;
	for(i=0;i<t;i++)
	{
		cin>>n;
		cout<<n<<endl;
		n_2=n/2;
		
		if(n%6==2)
		{
			for(j=1;j<n;j+=2)
			{
				for(int l=0;l<n*2+1;l++)
					cout<<"-";
				cout<<endl;
				for(int l=0;l<j;l++)
					cout<<"| ";
				cout<<"|*";
				for(int l=j+1;l<n;l++)
					cout<<"| ";
				cout<<"|"<<endl;
			}
			j=n-4;
			for(k=0;k<n_2;k++)
			{
				for(int l=0;l<n*2+1;l++)
					cout<<"-";
				cout<<endl;
				for(int l=0;l<j%n;l++)
					cout<<"| ";
				cout<<"|*";
				for(int l=j%n+1;l<n;l++)
					cout<<"| ";
				cout<<"|"<<endl;
				j+=2;
			}
			for(int l=0;l<n*2+1;l++)
					cout<<"-";
			cout<<endl;
			continue;
		}
		
		if(n%2==0)
		{
			for(int j=1;j<n;j+=2)
			{
				for(int l=0;l<n*2+1;l++)
					cout<<"-";
				cout<<endl;
				for(int l=0;l<j;l++)
					cout<<"| ";
				cout<<"|*";
				for(int l=j+1;l<n;l++)
					cout<<"| ";
				cout<<"|"<<endl;
			}
			for(int j=0;j<n;j+=2)
			{
				for(int l=0;l<n*2+1;l++)
					cout<<"-";
				cout<<endl;
				for(int l=0;l<j;l++)
					cout<<"| ";
				cout<<"|*";
				for(int l=j+1;l<n;l++)
					cout<<"| ";
				cout<<"|"<<endl;
			}
			for(int l=0;l<n*2+1;l++)
					cout<<"-";
			cout<<endl;
			continue;
		}
		
		if(n%6==3)
		{
            int j;      
			for(j=0;j<n;j+=2)
			{
				for(int l=0;l<n*2+1;l++)
					cout<<"-";
				cout<<endl;
				for(int l=0;l<j;l++)
					cout<<"| ";
				cout<<"|*";
				for(int l=j+1;l<n;l++)
					cout<<"| ";
				cout<<"|"<<endl;
			}
			j=n-4;
			for(int l=0;l<j%n;l++)
			{
				for(int l=0;l<n*2+1;l++)
					cout<<"-";
				cout<<endl;
				for(int l=0;l<j%n;l++)
					cout<<"| ";
				cout<<"|*";
				for(int l=j%n+1;l<n;l++)
					cout<<"| ";
				cout<<"|"<<endl;
			}
			for(int l=0;l<n*2+1;l++)
					cout<<"-";
			cout<<endl;
			continue;
		}

		for(j=0;j<n;j+=2)
		{
			for(int l=0;l<n*2+1;l++)
					cout<<"-";
				cout<<endl;
				for(int l=0;l<j;l++)
					cout<<"| ";
				cout<<"|*";
				for(int l=j+1;l<n;l++)
					cout<<"| ";
				cout<<"|"<<endl;
		}
		for(int j=1;j<n;j+=2)
		{
			for(int l=0;l<n*2+1;l++)
					cout<<"-";
				cout<<endl;
				for(int l=0;l<j;l++)
					cout<<"| ";
				cout<<"|*";
				for(int l=j+1;l<n;l++)
					cout<<"| ";
				cout<<"|"<<endl;
		}
		for(int l=0;l<n*2+1;l++)
					cout<<"-";
			cout<<endl;
		cout<<endl;
	}

	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