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

帮我看看是那错了

Posted by qsr10250030 at 2006-11-01 18:51:40 on Problem 1207
#include<iostream>
#include<conio.h>
using namespace std;
int main(){
    int i=1,j=1;
    int x,y,a,b;
   cin>>x>>y;
    a=x;b=y;
  while(x!=1)
    if(x%2==0)  {x/=2;i++;}
     else {x=3*x+1;i++;}
   while(y!=1)
    if(y%2==0)  {y=y/2;j++;}
     else {y=3*y+1;j++;}
   if(i>=j)
      cout<<a<<" "<<b<<" "<<i<<endl;
   else
      cout<<a<<" "<<b<<" "<<j<<endl;
      getch();
     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