题解 | #杨辉三角的变形#

杨辉三角的变形

http://www.nowcoder.com/practice/8ef655edf42d4e08b44be4d777edbf43

import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = Integer.valueOf(scan.nextLine().trim());
        if (n == 1 || n == 2) {
            System.out.println(-1);
        } else if (n % 2 != 0) {
            System.out.println(2);
        } else {
            System.out.println(n / 2 % 2 == 0 ? 3 : 4);
        }
    }
}
全部评论
该牛油正在参与牛客写题解薅羊毛的活动,牛币,周边,京东卡超多奖品放送,活动进入倒计时!快来捡漏啦https://www.nowcoder.com/discuss/888949?source_id=profile_create_nctrack&channel=-1
点赞
送花
回复
分享
发布于 2022-04-20 16:58

相关推荐

点赞 评论 收藏
转发
OPSL:钱确实给的多,但是追责这一点比较迷惑…3个月具体如何计算呢?出勤天数30*3吗?还是21*3呢?万一中间学校有安排怎么办呢?这个得多问一问呀
点赞 评论 收藏
转发
1 3 评论
分享
牛客网
牛客企业服务