JAVA 大佬们,这个代码咋就不行泥

P1035 [NOIP2002 普及组] 级数求和

缘起喵喵 @ 2020-01-11 16:38:31

import java.io.*;

import java.util.*;


public class Main {
public static void main(String args[]) throws Exception {
    Scanner write=new Scanner(System.in);
    int a = write.nextInt();
    float sum=1.0f;
    for(int i=1; i<=a ; i++){
        sum=sum+(float)(1.0/i);
    }
    System.out.println(sum);
}

}```


by Ares゜ @ 2020-01-11 17:15:09

C++它不香吗


by JRzyh @ 2020-01-20 20:18:21

你的MD有点怪


|