Advertisement
a53

nrnot

a53
Dec 21st, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. #include <fstream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int n,x,y,c;
  7. ifstream f("nrnot.in");
  8. f>>n>>x;
  9. c=n-x;
  10. while(f>>y)
  11. {
  12. if(x!=y)
  13. c+=x-y-1;
  14. x=y;
  15. }
  16. c+=y-1;
  17. ofstream g("nrnot.out");
  18. g<<c;
  19. return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement