Sum


Submit solution

Points: 100 (partial)
Time limit: 1.0s
Memory limit: 64M

Author:
Problem type
Allowed languages
Ada, BrainF***, C#, C++, Dart, Go, Java, JS, Kotlin, Lua, Pascal, Prolog, Python, Swift, VB

Description

Your task is to find the sum of all integer numbers lying between 1 and N inclusive.

Input specification

The input consists of a single integer N that is not greater than 10^4 by it's absolute value.

Output specification

Write to the output a single integer number that is the sum of all integer numbers lying between 1 and N inclusive.

Sample input

3

Sample output

6

Comments


  • 2
    Mauricio  commented on Dec. 14, 2023, 3:44 p.m.

    gente,si les da problema con el primer caso de prueba,mirenque tambin cuentan los negativos


  • 0
    ariel_programer  commented on June 3, 2023, 12:16 a.m.

    Tienen q tener en cuenta la suma de 1 a N Y si N es negativo entonces de N a 1


  • 0
    LeandroGamer  commented on May 28, 2023, 3:49 p.m.

    No se puede usar recursividad o sino te da TLE


  • 0
    TheRacistK  commented on March 12, 2023, 6:22 p.m.

    Recordad que es de 1 a N, no de 0 a N, por eso la mayoria tiene WA un un caso :/


  • 1
    Davisito10  commented on March 1, 2023, 11:46 p.m.

    me pasa lo mismo q a ustedes me da un WA y 50


  • -3
    leslie0505  commented on Dec. 15, 2020, 5:35 a.m.

    Un caso de prueba a mi me da W A y el otro 50 puntos


  • 13
    Alain_David  commented on April 7, 2020, 6:50 a.m.

    Nunk dijeron q n tuviera q ser positivo


    • -1
      aniervs  commented on April 8, 2020, 2:50 a.m.

      Si lo dicen, dicen que su valor absoluto no es mayor que 10^4.


      • 3
        Alain_David  commented on April 8, 2020, 7:51 p.m.

        Exacto |n|<=10^4 Pero n puede ser negativo


        • -4
          aniervs  commented on April 9, 2020, 5:31 a.m.

          y cuál es el punto?


  • -1
    Primervirgen  commented on July 23, 2019, 3:02 p.m.

    Alguien me puede decir xq se me va de tiempo el segundo caso de prueba, si le aplico una fórmula de inducción?


  • -4
    Chico_Troll  commented on Feb. 6, 2019, 3:54 a.m.

    Que es lo que pasa? me da solo 50 y un WA


  • -2
    Rogel_  commented on Jan. 11, 2019, 5:51 p.m. edited

    A mi me da WA y no se porque, si solo utilizo una formula, ademas utilize la variable mas grande


  • -4
    angelmh  commented on July 10, 2018, 1:18 p.m.

    Por que este problema en java me da TLE si solo uso una fórmula?