请解决问题 [英] Please solve the problem

查看:125
本文介绍了请解决问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法弄清楚问题的算法。问题如下:



问:有一个城市,一个人的年龄从未超过40岁。一旦达到40岁,你的年龄开始下降,即39,38, 37 .... 10。一旦你达到10岁,你的年龄将再次增加,即11,12,13 ...... 40。这无限次。





任何人都可以提供程序代码(我更好地理解'C')或者上述问题的算法。?



我尝试过:



我无法弄清楚算法

解决方案

看一下 while 循环,这里有一些关于它的信息: while循环C [ ^ ]


引用:

Q 。有一个城市,一个人从未超过40岁。一旦你达到40岁,你的年龄开始下降,即39,38,37 .... 10。一旦你达到10岁,你的年龄将再次增加,即11,12,13 ...... 40。这无限次。



这描述了一种情况,但是毫无疑问,所以没有算法来解决这个问题。

< blockquote class =quote>

引用:

我无法弄清楚算法



拿一张纸和铅笔试着解决您手动解决问题,您所遵循的证明就是您的算法。


I can not figure out the algorithm for a problem. The problem is below :

Q. There is a city where a person never ages more then 40. Once you reach 40, your age starts decreasing i.e. 39,38,37....10. Once you reached 10, your age will increase again i.e 11,12,13....40. This goes for infinite times.


Can anyone give the program code(its better for me to understand in 'C') or the algorithm for the problem above.?

What I have tried:

I can not figure out algorithm

解决方案

Take a look at the while loop, here is some information about it: while loop in C[^]


Quote:

Q. There is a city where a person never ages more then 40. Once you reach 40, your age starts decreasing i.e. 39,38,37....10. Once you reached 10, your age will increase again i.e 11,12,13....40. This goes for infinite times.


This describe a situation, but as there is no question, so there is no algorithm to solve the non question.

Quote:

I can not figure out algorithm


Take a sheet of paper and pencil and try to solve your problem by hand, the provedure you follow is your algorithm.


这篇关于请解决问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆