题解 | #序列和#

序列和

http://www.nowcoder.com/practice/46eb436eb6564a62b9f972160e1699c9

public class Main {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int N=scanner.nextInt();
        int L=scanner.nextInt();
        for(;L<=100;L++){
            double a1=(2*N+L-L*L)/(2.0*L);
            int a11= (int) a1;
            if(a1>=0 && Math.abs(a1-a11)<0.0001){
                for(int i=0;i<L;i++) {
                    int res=a11+i;
                    System.out.print(res+" ");
                }

                return;
            }

        }
        System.out.print("No");
    }
}
全部评论

相关推荐

05-03 12:45
西南大学 Java
nsnzkv:你这项目写的内容太多了,说实话都是在给自己挖坑,就算简历过了,后面面试也难受
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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