y*y
7 楼
He deleted his post because he know he made a mistake.
BUt it seems you still dont understand and self-feeling good.
What I mean is int(x+0.5) gives you x if x is an interger itself.
but 四舍五入 gives you x+1. so int(x+0.5) is a wrong answer. You need
to write if-else.
【在 h**h 的大作中提到】![](/moin_static193/solenoid/img/up.png)
: take it easy, think about so many non-cs majors changed to
: Computer Science.
: It is always hard to get started.
BUt it seems you still dont understand and self-feeling good.
What I mean is int(x+0.5) gives you x if x is an interger itself.
but 四舍五入 gives you x+1. so int(x+0.5) is a wrong answer. You need
to write if-else.
【在 h**h 的大作中提到】
![](/moin_static193/solenoid/img/up.png)
: take it easy, think about so many non-cs majors changed to
: Computer Science.
: It is always hard to get started.
y*y
8 楼
faint...it seems I made the mistake....anyway,sometimes brain
stalk....:(
【在 y***y 的大作中提到】![](/moin_static193/solenoid/img/up.png)
: He deleted his post because he know he made a mistake.
: BUt it seems you still dont understand and self-feeling good.
: What I mean is int(x+0.5) gives you x if x is an interger itself.
: but 四舍五入 gives you x+1. so int(x+0.5) is a wrong answer. You need
: to write if-else.
stalk....:(
【在 y***y 的大作中提到】
![](/moin_static193/solenoid/img/up.png)
: He deleted his post because he know he made a mistake.
: BUt it seems you still dont understand and self-feeling good.
: What I mean is int(x+0.5) gives you x if x is an interger itself.
: but 四舍五入 gives you x+1. so int(x+0.5) is a wrong answer. You need
: to write if-else.
b*d
16 楼
Best? How do you evaluate if a program is good or poor?
Do you think such code is in good style?
【在 l*l 的大作中提到】![](/moin_static193/solenoid/img/up.png)
: you are smart, but the code is too long, even it is sample.
: I write one line and solve it, I guess it is the best code any one can
: get.
: print int(($x+abs($x))/2+0.5)+int(($x-abs($x))/2-0.5);
Do you think such code is in good style?
【在 l*l 的大作中提到】
![](/moin_static193/solenoid/img/up.png)
: you are smart, but the code is too long, even it is sample.
: I write one line and solve it, I guess it is the best code any one can
: get.
: print int(($x+abs($x))/2+0.5)+int(($x-abs($x))/2-0.5);
相关阅读
How can I use Tag in nedit?这几个网络模拟软件哪个比较好啊?Help! How to replace string in a variable?自己能不能建个MAILING LIST(不是root)?how to setup lib path?SunOS 5.5 / Solaris 2.5 Installation CDs想写个小东东pthread_kill SIGINT SIG_DFL multithreadssh怎么用?How to get the memory size of a SUN workstation?Urgent! -- Can I run KDE from the Solaris terminaUNIX的中文TERM[转载] ping是怎么工作的?大虾,救命!Linux故障!问个土问题打印问题help!how to program C and C++(mixed)Installation of cxterm on SGIhelp! Re: some wtHelp: what does it mean?