一. 题目描述
hanayo
很喜欢吃米饭。
有一天,她拿出了 个碗,第一个碗装了 1 粒米饭,第二个碗装了 2 粒米饭,以此类推,第 n 个碗装了 n 粒米饭。
然而,爱搞恶作剧的rin
把所有的碗的顺序打乱,并拿走了一个碗。hanayo
想知道,rin
拿走的碗里有多少粒米饭?
二. 测试用例
三. 代码
#include <iostream>
using namespace std;
#include <cmath>
int main(){
int n;
cin >> n;
int rice_mass = ((n+1)*n)/2;
int now_rice_mass = 0;
for(int i=0;i<n-1;i++){
int foo;
cin >> foo;
now_rice_mass += foo;
}
cout << (rice_mass - now_rice_mass) << endl;
return 0;
}