- 有一串彩灯,7盏7盏地数,最后多1盏;8盏8盏地数,最后多3盏;9盏9盏地数,恰好不多也不少。这串彩灯最少有几盏?
#include <iostream>
using namespace std;
int main()
{ int x=1;
for(;;x++) {
if(9*x%7==1&&9*x%8==3)
{cout<<"彩灯最少有"<<9*x<<"盏";
break;} }
return 0;}
来源:https://blog.csdn.net/DivineK/article/details/100767529