题解 | #Biorhythms#

Biorhythms

https://www.nowcoder.com/practice/aa66f85934c142f3af2da111dc864d9f

//代码还是比较简单的,按天数枚举即可,就是英文最后有些读不懂了,还是查的翻译...
#include "stdio.h"

int main(){
    int physical,emotional,intellectual;//分别为记录对应的日期(今年第几天出现)
    int date;//现在是今年第几天
    scanf("%d%d%d%d",&physical,&emotional,&intellectual,&date);
    int nextday = 1;
    bool p_flag,e_flag,i_flag;
    while (true){
        p_flag = false;e_flag = false;i_flag = false;
        if((nextday + date - physical)%23 == 0)
            p_flag = true;
        if((nextday + date - emotional)%28 == 0)
            e_flag = true;
        if((nextday + date - intellectual)%33 == 0)
            i_flag = true;
        if(p_flag && e_flag && i_flag)
            break;
        ++nextday;
    }
    printf("Case: the next triple peak occurs in %d days.",nextday);
}

全部评论

相关推荐

不愿透露姓名的神秘牛友
07-11 17:10
什么素质,我请问呢,要掉小珍珠了。。。又憋屈又生气
苍蓝星上艾露:给它们能的,一群dinner牛马挥刀向更弱者罢了。我写的开源求职AI co-pilot工具,优化你的简历,找到你匹配的岗位,定制你的简历,并让你做好面试准备https://github.com/weicanie/prisma-ai
点赞 评论 收藏
分享
07-07 17:06
已编辑
深圳技术大学 golang
点赞 评论 收藏
分享
强大的马里奥:不太可能,我校计算机硕士就业率99%
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务