C++代码:
/*
韩信点兵(奥数)
背水一战
四面楚歌
韩信用兵 多多益善
1500 战死四五百人
3x+2
5y+4
7z+6
还剩多少兵
*/
#include<iostream>
using namespace std;
int main()
{
int i;
i=1000;
while ( true )
{
if( i%3==2 && i%5==4 && i%7==6 )
{
break;
}
i++;
}
cout<<i<<endl;
return 0;
}
scratch2代码:
scratch3代码:
python3代码:
"""
第45课 蝴蝶效应-动动脑 第3题 《小学生C++趣味编程》
"""
i=1000
while 1:
if i%3==2 and i%5==4 and i%7==6:
break
i+=1
print(i)