Ankit_132

Remove Multiples

Jun 28th, 2023
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5.     int t;
  6.     cin>>t;
  7.    
  8.     while(t--)
  9.     {
  10.         int n, m;
  11.         cin>>n>>m;
  12.        
  13.         vector<int> a(m);
  14.         for(auto &e: a)
  15.             cin>>e;
  16.        
  17.         long long int suma = accumulate(a.begin(), a.end(), 0ll);
  18.         long long int tot = ((n*1ll*(n+1))/2);
  19.        
  20.         cout<<tot - suma<<"\n";
  21.     }
  22. }
  23.  
Advertisement
Add Comment
Please, Sign In to add comment