Advertisement
STANAANDREY

arc

Mar 8th, 2019
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.39 KB | None | 0 0
  1. #include <fstream>
  2. using namespace std;
  3.  
  4. ifstream f("arc.in");
  5. ofstream g("arc.out");
  6.  
  7. void cer1()
  8. {
  9.     long n,aux,x,i,nrs=1;
  10.     f>>n>>aux;
  11.     for (i=1;i<n;i++)
  12.     {
  13.         f>>x;
  14.         if (x!=aux)
  15.             nrs++;
  16.         aux=x;
  17.     }
  18.     g<<nrs;
  19. }
  20.  
  21. void cer2 ()
  22. {
  23.  
  24.  
  25.  
  26. }
  27.  
  28. int main()
  29. {
  30.  
  31. short p;
  32. f>>p;
  33. if (p==1)
  34.   cer1();
  35.   else
  36.     cer2();
  37.  
  38. return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement