paradox64ce

Codeforces A Inscribed Figures

Jun 1st, 2019
114
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. #include <iostream>
  3. #include <string>
  4. #include <bits/stdc++.h>
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.    
  10. int n;
  11. cin>>n;
  12. int arr[n];
  13. for(int i=0;i<n;i++)
  14. {
  15.     cin>>arr[i];
  16. }
  17.  
  18. int count=0;
  19. for(int j=0;j<n-1;j++)
  20. {
  21.     if((arr[j]==1) and (arr[j+1]==2))
  22.     {
  23.         count+=3;
  24.     }
  25.     else
  26.     if((arr[j]==2) and (arr[j+1]==1))
  27.     {
  28.         count+=3;
  29.     }
  30.     else
  31.     if((arr[j]==1) and (arr[j+1]==3))
  32.     {
  33.         count+=4;
  34.     }
  35.     else
  36.     if((arr[j]==3) and (arr[j+1]==1))
  37.     {
  38.         count+=4;
  39.     }
  40.     else
  41.     if((arr[j]==2) and (arr[j+1]==3))
  42.     {
  43.         cout<<"Infinite\n";
  44.         return 0;
  45.     }
  46.     else
  47.     if((arr[j]==3) and (arr[j+1]==2))
  48.     {
  49.         cout<<"Infinite\n";
  50.         return 0;
  51.     }
  52.    
  53. }
  54. cout<<"Finite\n"<<count;
  55.  
  56.     return 0;
  57. }
RAW Paste Data