코드포스 486A (codeforces 486A)

코드포스 486A (codeforces 486A) 문제 풀이 및 코드 (description and code)

Problem - 486A - Codeforces

코드

import java.io.*;

public class CF486A {
    static long n, ans = 0;
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        n = Long.parseLong(br.readLine());
        ans = (n % 2 == 0) ? n/2 : n/2 - n;
        bw.write(ans + "\n");
        bw.flush();bw.close();
    }
}

설명

Copied to clipboard