QOJ.ac

QOJ

Límite de tiempo: 2 s Límite de memoria: 1024 MB

#23989. คารุตะ

Estadísticas

โจทย์ปัญหา

มีการจัดการแข่งขันคารุตะแบบพบกันหมดที่มีนักเรียนเข้าร่วม $N$ คน

ในการแข่งขันนี้ ทุกนัดจะมีนักเรียนเข้าร่วม $2$ คน และนักเรียน $2$ คนที่แตกต่างกันคู่ใดๆ จะแข่งขันกันใน $1$ นัดพอดี

จงหาจำนวนนัดการแข่งขันทั้งหมดที่จัดขึ้นตลอดทั้งทัวร์นาเมนต์

ข้อจำกัด

  • $2 \le N \le 100$
  • $N$ เป็นจำนวนเต็ม

ข้อมูลนำเข้า

ข้อมูลนำเข้าจะให้มาในรูปแบบต่อไปนี้:

N

ข้อมูลส่งออก

จงแสดงจำนวนนัดการแข่งขันทั้งหมดที่จัดขึ้นตลอดทั้งทัวร์นาเมนต์

ห้ามแสดงสิ่งอื่นใดนอกจากคำตอบ (เช่น ห้ามแสดงข้อความที่ให้ป้อนข้อมูลนำเข้า)

สำหรับรูปแบบการส่งคำตอบ สามารถดูตัวอย่างได้จากโจทย์ฝึกหัดและตัวอย่างคำตอบ

ตัวอย่างที่ 1

ข้อมูลนำเข้า

3

ข้อมูลส่งออก

3

สมมติให้ผู้เข้าร่วม $3$ คนคือ A, B, C ในกรณีนี้ การแข่งขันที่จัดขึ้นตลอดทั้งทัวร์นาเมนต์คือ $3$ นัดดังต่อไปนี้:

  • A พบกับ B
  • A พบกับ C
  • B พบกับ C

ตัวอย่างที่ 2

ข้อมูลนำเข้า

4

ข้อมูลส่งออก

6

สมมติให้ผู้เข้าร่วม $4$ คนคือ A, B, C, D ในกรณีนี้ การแข่งขันที่จัดขึ้นตลอดทั้งทัวร์นาเมนต์คือ $6$ นัดดังต่อไปนี้:

  • A พบกับ B
  • A พบกับ C
  • A พบกับ D
  • B พบกับ C
  • B พบกับ D
  • C พบกับ D

ตัวอย่างที่ 3

ข้อมูลนำเข้า

2

ข้อมูลส่งออก

1

ตัวอย่างที่ 4

ข้อมูลนำเข้า

100

ข้อมูลส่งออก

4950

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.