ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1068. Sum

What's wrong? test #9
Posted by Dormidont3 26 Feb 2014 23:40
#include <iostream>

int main()
{
    double an,s;
    int n;
    std::cin>>an;

    if (an>1) {n=an; s=(an+1)/2*n;}
    else
    {if (an==0) {s=1;}
        else
    {n=-(an+1); s=((an-2)/2*n);}}
    std::cout<<s;
    return 0;
}