Advertisement
tomalikem

tomb

Jun 7th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int how_many_ways(string map, int N) {
  6.     int t[6];
  7.     int x;
  8.     for(int i=0; i<6; i++)t[i]=1;
  9.     for(int i=1; i<N; i++)
  10.     {
  11.         x=t[i%6];
  12.         t[i%6]=0;
  13.         if(map[i]=='1')
  14.         {
  15.             for(int j=0;j<6;j++)t
  16.                 [j]+=x;
  17.         }
  18.     }
  19.     return x;
  20. }
  21.  
  22. int main() {
  23.     int N;
  24.     cin >> N;
  25.     string map;
  26.     cin >> map;
  27.     if (map.size() != N) {
  28.         cout << "Incorrect map size" << endl;
  29.         return -1;
  30.     }
  31.     cout << how_many_ways(map, N) << endl;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement