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

1657 哪位高人帮忙看一下,运行一下,错在哪里?自己机上可以运行的

Posted by cpp00548016 at 2006-03-02 18:00:22 on Problem 1657
#include<iostream>
#include<cmath>
using namespace std;
void main()
{
	int t,i,j,s[20][2];
	cin>>t;
    char start[2],end[2];
	for(j = 0 ; j < t ; j++)
	{
		for(i = 0 ; i < 2 ; i++)
		    cin>>start[i];	
	    for(i = 0 ; i < 2 ; i++)
		    cin>>end[i];
		for( i=0 ; i < 2 ; i++)
		{
		    s[j][i] = abs ((int)start[i] - (int)end[i]);
		}
	}
	for( j=0 ;j < t; j++)
	{
		if ( s[j][0] >= s[j][1] )
		    cout<<s[j][0]<<" ";
		else
		    cout<<s[j][1]<<" ";
		if ( s[j][0] == 0 || s[j][1] == 0 || s[j][0] == s[j][1] )
		    cout<< 1 <<" ";
	    else
		    cout<< 2 <<" ";
	    if ( s[j][0] == 0 || s[j][1] == 0 )
		    cout<< 1 <<" ";
	    else
		    cout<< 2 <<" ";
	    if( s[j][0] == s[j][1] )
		   cout<< 1 <<" ";
	   else if ( ( abs (s[j][0] - s[j][1]) ) % 2 ==0 )
		   cout<< 2 <<" ";
		   else
			   cout<<"Inf";
		   cout<<endl;
	}
		

}


Followed by:
  • a1 a1 (978) TN 2006-03-02 18:12:01

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