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

Tiniest and most ub3rl33t ever AC solution of this problem.
Posted by Exile 1 Aug 2005 05:18
C++ is such a beautiful language! I'm simply starting to love it :) Do you know if there are some free online books about coding in c++ availible on the internet? If you know about any, I'd be most grateful if you give me a link. Thanks in advance! :)

#include <iostream.h>

void main()
{
    short int n;
    cin >> n;
    cout << ((n>0?n*n:2-n*n)+n)/2;
}

// Enjoy :)