0
点赞
收藏
分享

微信扫一扫

蓝桥杯C/C++猴子分香蕉题目

船长_Kevin 2022-02-24 阅读 57
蓝桥杯c++
#include <iostream>
using namespace std;
int main()
{
    int a, b, c, d, e;
    for (a = 1; a > 0; a++)
    {
        if (a % 5 == 1 && a > 1)
        {
            b = (a - 1) * 4 / 5;
            if (b % 5 == 2 && b > 2)
            {
                c = (b - 2) * 4 /5;
                if (c % 5 == 3 && c > 3)
                {
                    d = (c - 3) * 4 / 5;
                    if (d % 5 == 4 && d > 4)
                    {
                        e = (d - 3) * 4 /5;
                        if (e % 5 == 0 && e > 0)
                        {
                            cout << a;
                            break;
                        }
                    }
                }
            }
        }
    }
    return 0;
}
举报

相关推荐

0 条评论