CSES Solutions
#1083Introductory Problems

Missing Number

View on CSES

Solution

1083-Missing_Number.cpp
1#include<bits/stdc++.h>
2using namespace std;
3#define int long long
4signed main(){
5  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
6  int n,e; cin>>n;
7  int ans=n*(n+1)/2;
8  for(int _=1;_<n;++_){
9    cin>>e;
10    ans-=e;
11  }
12  cout<<ans<<'\n';
13  return 0;
14}

Editorial not yet generated for this problem. Run the editorial generation script to add hints and detailed explanations.