Răspuns:
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("nrnot.in");
ofstream g("nrnot.out");
int main()
{
unsigned total = 0;
unsigned int n,x,y;
f>>n>>x;
y=x;
total+=(n-x);
while(f>>x)
{
if(x!=y)
total+=(y-x-1);
y=x;
}
total+=(x-1);
if(total!=0)
g<<total;
else
g<<"NU";
return 0;
}
Explicație: