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

compilation trouble
Posted by Woz3qK 15 Jan 2007 20:53
there are no errors. why?

#include <iostream.h>
int main()
{
  int i,j;
  cin >> i;

  j= abs(i)*(abs(i)+1)/2;
  if (i>=1) cout << j; else
  cout << (-j+1);
}
Re: compilation trouble
Posted by Roma Labish[Lviv NU] 15 Jan 2007 21:14
#include <iostream>   // <-- Problem was here
using namespace std;  // change it in your solution
int main()
{
int i,j;
cin >> i;

j= abs(i)*(abs(i)+1)/2;
if (i>=1) cout << j; else
cout << (-j+1);
}