34 lines
464 B
C++
34 lines
464 B
C++
|
#include <iostream>
|
||
|
#include <cstdlib>
|
||
|
#include <string>
|
||
|
#include <sstream>
|
||
|
|
||
|
int
|
||
|
main(void)
|
||
|
{
|
||
|
|
||
|
size_t n;
|
||
|
std::cin >> n;
|
||
|
bool *a = (bool *)calloc(n, sizeof(bool));
|
||
|
|
||
|
std::string input;
|
||
|
getline(std::cin, input); // discard extra newline
|
||
|
getline(std::cin, input);
|
||
|
std::istringstream iss(input);
|
||
|
|
||
|
std::string s;
|
||
|
while (getline(iss, s, ' '))
|
||
|
{
|
||
|
a[stoi(s)-1] = 1;
|
||
|
}
|
||
|
|
||
|
for (size_t i = 0; i < n; i++)
|
||
|
{
|
||
|
if (!a[i])
|
||
|
{
|
||
|
std::cout << i+1;
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
}
|