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

大虾的提醒使我茅塞顿开 但我用九进制写的程序还是RE,真不该怎么班!!!!还请大虾指点。。。(附程序)

Posted by toughcat at 2005-12-28 22:25:22 on Problem 2719
#include<stdio.h>
void main()
{
   long int num[10000],temp,duck,big;
   int a,b,i=0,x;
   while(1)
   {
     scanf("%ld",&num[i]);
	 if(num[i]==0)
		 break;
	 i++;
   }
   for(a=0;a<i;a++)
   {
     temp=0;
	 for(b=0,duck=10,big=1;b<9;b++)
	 {
		 x=(num[a]%duck)/(duck/10);
	  
		 if(x>=0&&x<=3)
			 temp+=x*big;
		 else
			 if(x>4&&x<=9)
			 temp+=(x-1)*big;
		 duck*=10;
		 big*=9;
	 }
	 printf("%ld: %ld\n",num[a],temp);
   
   }

  }

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