问题:设有一阶梯,每步跨2阶。最后余1阶。每步跨3阶。最后余2阶;每步跨5阶。最后余4阶;每步跨6阶。最后余5阶;每步跨7阶。刚好到阶顶。问共同拥有多少阶梯?

using System;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int i = 1;
while (!((i % 2 == 1) && (i % 3 == 2) && (i % 5 == 4) && (i % 6 == 5) && (i % 7 == 0)))
{
i++;
}
Console.WriteLine(i);
}
}
}

答案:119

C#趣味程序---爱因斯坦的台阶问题的更多相关文章

  1. C#趣味程序---车牌号推断

    甲说前两位同样,乙说后两位同样,丙说四位的车牌号刚好是一个数的平方.这个车牌号是多少? using System; namespace ConsoleApplication1 { class Prog ...

  2. C#趣味程序---求两个数的最大公约数和最小公倍数

    using System; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { Cons ...

  3. C#趣味程序---水仙花数

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...

  4. C#趣味程序---理財高手

    问题:如果银行存款分五种 利率:0.63%  一年   月 利率:0.66%  二年   月 利率:0.69%  三年   月 利率:0.75%  五年   月 利率:0.84%  八年   月 如今 ...

  5. C#趣味程序---百鸡百钱

    问题:公鸡一仅仅5元,母鸡一仅仅3元,小鸡三仅仅1元.问100元能够买多少仅仅鸡? using System; namespace ConsoleApplication1 { class Progra ...

  6. C#趣味程序---九九乘法表

    using System; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { for ...

  7. C#趣味程序----分数之和

    问题:求这种四个自然数p,q,r,s(p<=q<=r<=s).使得等式1/p + 1/q +1/r +1/s=1成立. 分析:将原式同分,化简整理后得到:2<=p<5,p ...

  8. C#趣味程序---三色球问题

    问题:若一个口袋中放有12个球,3红3白和6黑,问从袋中随意取8个球,有多少种不同的颜色搭配? using System; namespace ConsoleApplication1 { class ...

  9. C#趣味程序---个位数为6,且能被3整出的五位数

    using System; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { int ...

随机推荐

  1. oracle sql 优化大全

    转自: http://panshaobinsb.iteye.com/blog/1718233 http://yulimeander.blog.sohu.com/115850824.html 最近遇到了 ...

  2. MFC DLL对话框调用

    Regular Dll using shared MFC DLL extern "C" __declspec(dllexport) void Show() {   AFX_MANA ...

  3. sql 的 DATE_FORMATE()函数

    定义和用法 DATE_FORMAT() 函数用于以不同的格式显示日期/时间数据. 语法 DATE_FORMAT(date,format) date 参数是合法的日期.format 规定日期/时间的输出 ...

  4. Spark RDD API扩展开发

    原文链接: Spark RDD API扩展开发(1) Spark RDD API扩展开发(2):自定义RDD 我们都知道,Apache Spark内置了很多操作数据的API.但是很多时候,当我们在现实 ...

  5. 通过javascript获取元素position

    function getOffset( el ) { var _x = 0; var _y = 0; while( el && !isNaN( el.offsetLeft ) & ...

  6. LinuxMint19/LMDE3安装后的设置

    LinuxMint 安装后进行一些设置. 1.设置主板时间为本地时间,默认为UTC时间,与Windows不同,如果双系统,时间有时差. sudo timedatectl set-local-rtc t ...

  7. Linux下解决 id_rsa 权限不够

    问题 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @         WARNING: UNPROTECTED PRIVAT ...

  8. javascript刷新父页面方法总结

    用iframe.弹出子页面刷新父页面iframe <script language=JavaScript> parent.location.reload(); </script> ...

  9. RS查询报错之递归公用表表达式不包含顶级 UNION ALL运算符

    在FM里面涉及模型的时候,修改了物理层的查询SQL如下 select * from TARGET_VISIT_GH where ghksdm in(select dept_id from DIM_BI ...

  10. Could not parse the file: d:\matlab7\toolbox\ccslink\ccslink\info.xml

    找到安装目录下的info.xml文件,用记事本打开. 我的安装目录是:D:\MATLAB7\toolbox\ccslink\ccslink 用记事本打开,显示如下内容: <productinfo ...