QOJ.ac

QOJ

시간 제한: 2 s 메모리 제한: 1024 MB

#23989. Karuta

통계

問題文

N 人の生徒が参加するかるたの総当たり戦の大会が開催される.

この大会では,どの試合にも 2 人の生徒が参加し,どの異なる 2 人の生徒の組もちょうど 1 試合で対戦する.

大会全体で行われる試合の総数を求めよ.

制約

  • 2 ≦ N ≦ 100.
  • N は整数である.

入力

入力は以下の形式で与えられる.
N

出力

大会全体で行われる試合の総数を出力せよ.

答え以外は何も出力しないこと.(入力を促す文章なども出力しないこと.)

解答形式については,練習問題やその解答例 を参考にしても良い.


入力例 1

3

出力例 1

3

3 人の参加者を A, B, C とする.このとき, 大会全体で行われる試合は以下の 3 試合である.

  • A 対 B
  • A 対 C
  • B 対 C

入力例 2

4

出力例 2

6

4 人の参加者を A, B, C, D とする.このとき, 大会全体で行われる試合は以下の 6 試合である.

  • A 対 B
  • A 対 C
  • A 対 D
  • B 対 C
  • B 対 D
  • C 対 D

入力例 3

2

出力例 3

1

入力例 4

100

出力例 4

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.