缺少的数字

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

题目背景

翻译自 CSES-1083 题。

题目描述

你得到了一个序列 1,2,,n1,2,\cdots,n,但是这个序列中恰好缺失了一个数字。你的任务就是找到那个缺失的数字。

输入格式

第一行输入一个整数 nn

第二行输入 n1n-1 个整数,输入的 n1n-1 个整数都在 [1,n][1,n] 之间,并且每个值只出现一次。

输出格式

输出一行一个整数,表示那个缺失的数字。

样例

5
2 3 1 5
4

说明/提示

2n2×1052\le n \le 2\times10^5

CSES练习一 枚举、模拟、数学

Not Claimed
Status
Done
Problem
19
Open Since
2025-5-1 0:00
Deadline
2025-6-2 23:59
Extension
24 hour(s)