코드포스 268B (codeforces 268B)

코드포스 268B (codeforces 268B) 문제 풀이 및 코드 (description and code)

Problem - 268B - Codeforces

코드

import java.io.*;

public class CF268B {
    static int n, ans;
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        ans = n = Integer.parseInt(br.readLine());
        for (int i = 1; i < n; i++) {
            ans += i * (n - i);
        }
        bw.write(ans + "\n");
        bw.flush();bw.close();
    }


}

설명

Copied to clipboard