| ||||||||||
| 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:有人解释下我的程序为什么对吗?莫名其妙地过了...In Reply To:有人解释下我的程序为什么对吗?莫名其妙地过了... Posted by:zjx20 at 2008-06-17 23:06:54 >
> char n[10]
> gets(n)
> r=0 //结果
> len=strlen(n)
> for(i=0;i<len;i++)
> {
> p=n[i]-'0';
> if(p>4) p--;
> r += r*8+p;
> }
解释:这题本来就相当于9进制转换成十进制,你这不就是九进制的转换过程吗(不过你这个r*8不知道是怎么对的)?
我无语,你不知道原理还做出来了(而且有问题)。你才是万中无一的高手啊
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator