读书人

两道面试解决思路

发布时间: 2012-03-02 14:40:29 作者: rapoo

两道面试
A car traveled 462 miles per thankful of gasonline on the highway and 336 miles per thankful of gasonline in the city.If the car traveled 6 fewer miles per gallon in the city than on the highway,how many miles per gallon did the car travel in the city?
A.14 B.16 C.21 D.22 E27

Kim bought a tatal of $2.65 worth of postage stamps in for denominations. If the bought an equal number of 5-cent stamps,what is the least number of 1-cent stamps she could have bought?
A.5 B.10 C.15 D.20 E.25

[解决办法]
1、实际上就是求一个方程 :462/336=(x+6)/x => 462x==336(x+6)
main()
{
for( i=1;i <=27;i++)
{
while(462*i==336*(i+6))
printf( "%d ",i);
}
}
....................................

------------------------------------
答案是16

读书人网 >C语言

热点推荐