QOJ.ac

QOJ

حد الوقت: 1 s حد الذاكرة: 32 MB مجموع النقاط: 10

#11644. 和

الإحصائيات

John 的数学成绩很差。老师给了他一项额外的任务。John 需要编写一个程序,计算从 $1$ 到 $n$ 的整数之和。如果他能提交一个正确的程序,他的差评将被取消。

编写一个程序,完成以下操作:

  • 从标准输入读取整数 $n$。
  • 计算从 $1$ 到 $n$ 的整数之和。
  • 将结果写入标准输出。

输入格式

标准输入的第一行也是唯一一行包含一个整数 $n$ ($1 \le n \le 10\,000$)。

输出格式

将一个整数写入标准输出。该整数应为从 $1$ 到 $n$ 的整数之和。

样例

输入 1

3

输出 1

6

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.