Monday, March 16, 2015

486A - Calculating Function (Codeforces)

#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
using namespace std;
#define pf printf
#define sf scanf

int main()
{
    long long n;
    while(sf("%lld", &n)==1)
    if(n%2==0)
    {
        n= (n/2);
        pf("%lld\n", n);
    }
    else
    {
        n = ((n+1)/2)*(-1);
        pf("%lld\n", n);
    }
}

1 comment:

Compare equality of two string in C

#include <stdio.h> #include<string.h> int main() {     char* country = "Bangladesh";     char* country2;     ...