Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- using namespace std;
- int main()
- {
- int n,x,y,c;
- ifstream f("nrnot.in");
- f>>n>>x;
- c=n-x;
- while(f>>y)
- {
- if(x!=y)
- c+=x-y-1;
- x=y;
- }
- c+=y-1;
- ofstream g("nrnot.out");
- g<<c;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement