题解 | #Biorhythms#暴力枚举就行

Biorhythms

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

import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int p = sc.nextInt();
        int e = sc.nextInt();
        int i = sc.nextInt();
        int d = sc.nextInt();
        int ans = d;
        while (ans == 0 || (ans - p) % 23 != 0 || (ans - e) % 28 != 0 || (ans - i) % 33 != 0) {
            ans++;
        }
        System.out.println("Case: the next triple peak occurs in " + (ans - d) + " days.");
    }
}

全部评论

相关推荐

05-14 20:34
门头沟学院 Java
窝补药贝八股:管他们,乱说,反正又不去,直接说680
点赞 评论 收藏
分享
05-20 21:57
已编辑
门头沟学院 Java
喜欢吃卤蛋的悲伤蛙在...:建信融通没消息吧,我2说有实习挂简历不理了
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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