Codeforces Calculating Function

来源:互联网 发布:手机卡iphone7在线软件 编辑:程序博客网 时间:2024/06/05 21:04


题目链接:http://codeforces.com/contest/486/problem/A


题目分析:注意数据的大小

import java.util.Scanner;public class Calculating_Function {public static void main(String[] args) {Scanner scanner = new Scanner(System.in);long n = scanner.nextLong();if(n % 2 == 0) {System.out.println(n / 2);} else {System.out.println(-(Math.abs(n)+1)/2);}}}


原创粉丝点击