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

в чем может быть проблема? wrong answer
Posted by remark 5 Jun 2013 12:23
    using System;
    using System.Globalization;

    namespace a_b
    {
        public class Program
        {
            private static void Main()
            {
                int first = 0;
                int N = int.Parse(Console.ReadLine());
                if (N <= System.Math.Abs(1000))
                {
                    if (N == 1)
                    {
                        first = 1;
                        for (int i = 1; i <= N; i++)
                        {
                            first += i;
                        }
                    }

                    if (N > 1)
                    {
                        first = 0;
                        for (int i = 0; i <= N; i++)
                        {
                            first += i;
                        }
                    }

                    if (N < 1)
                    {
                        first = 1;
                        for (int i = 0; i >= N; i--)
                            first += i;
                    }
                    Console.WriteLine(first);
                }
            }
        }
    }