| ||||||||||
| 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 | |||||||||
大虾的提醒使我茅塞顿开 但我用九进制写的程序还是RE,真不该怎么班!!!!还请大虾指点。。。(附程序)#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator