yukicoder No.51 やる気の問題

Problem

No.51 やる気の問題 - yukicoder

Code

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {


    public static void main(String[] args) throws IOException {
        BufferedReader reader =new BufferedReader(new InputStreamReader(System.in));
        long W = Long.parseLong(reader.readLine());
        long D = Long.parseLong(reader.readLine());
        while(D !=1) {
            W = W - W/(D*D);
            D -= 1;
        }

        System.out.println(W);

    }
}
Remove all ads