POJ 4148生理周期

这篇博客介绍了POJ 4148题目中的生理周期问题。作者给出了两种解题思路:一是简单枚举,从d+1开始枚举三花聚顶之日a,直到满足条件输出a-d;二是优化枚举,通过减少枚举范围来提高效率。文中提供了相应的代码实现。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

POJ 4148生理周期

在这里插入图片描述

样例输入

0 0 0 0
0 0 0 100 
5 20 34 325
4 5 6 7 
283 102 23 320
203 301 203 40
-1 -1 -1 -1

样例输出

Case 1: the next triple peak occurs in 21252 days.
Case 2: the next triple peak occurs in 21152 days.
Case 3: the next triple peak occurs in 19575 days.
Case 4: the next triple peak occurs in 16994 days.
Case 5: the next triple peak occurs in 8910 days.
Case 6: the next triple peak occurs in 10789 days.

  • 思路1:
    枚举,设置变量a是三花聚顶之日,将a从d+1开始不断枚举,知道满足三花聚顶的条件,输出a-d

-code1:

#include <cstdio>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值