求助大佬为什么只有60分

P1035 [NOIP2002 普及组] 级数求和

xy75491414 @ 2019-10-25 11:27:10

import java.util.Scanner;

public class Main {

    public static void main(String[] args)throws Exception {
        int n = 0;      
        float k;
        Scanner cin = new Scanner(System.in);
        k = (float)cin.nextInt();
        if(k<=15 && k>= 1){
            for(float sn = 0;sn <= k ; ++n,sn+= 1.0/n){
            }
        }

        System.out.println((int)n);
    }

}

by Belarus @ 2019-10-25 11:54:15

用了Markdown,好评
没转C++,差评
(滑稽)


|