Advertisement
tepyotin2

Untitled

Jul 8th, 2023
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.48 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. bool isDiag = false;
  5.  
  6.  
  7. int N;
  8.  
  9. void fill(vector<int> &li, int va){
  10.     int beg = va - 2;
  11.     if(beg < 1) beg = N + beg ;
  12.    
  13.     //if(isDiag) cout <<"va: " << va << ", beg: " << beg << endl;
  14.     for (int i = 0; i < 5; i++)
  15.     {
  16.         int next = beg + i;
  17.         if(next > N){
  18.             next = next % N;
  19.         }
  20.         if(next == 0) {
  21.             //!!!problem must not contain 0
  22.             next = 1;
  23.         }
  24.         li.push_back(next);
  25.     }
  26.    
  27. }
  28.  
  29. int main(){
  30.     //isDiag = true;
  31.     if (isDiag)
  32.     {
  33.         freopen(  "P7 combo/3.in", "r", stdin);
  34.     }else{
  35.         freopen(  "combo.in", "r", stdin);
  36.     }
  37.    
  38.    
  39.     int ans = 0;   
  40.    
  41.     cin >> N ;
  42.     vector<int> j1 ;
  43.     vector<int> j2 ;
  44.     vector<int> j3 ;
  45.     vector<int> m1 ;
  46.     vector<int> m2 ;
  47.     vector<int> m3 ;
  48.    
  49.  
  50.     int v1, v2, v3;
  51.     cin >> v1 >> v2 >> v3;
  52.     fill(j1, v1);
  53.     fill(j2, v2);
  54.     fill(j3, v3);
  55.     cin >> v1 >> v2 >> v3;
  56.     fill(m1, v1);
  57.     fill(m2, v2);
  58.     fill(m3, v3);
  59.     set<string> dat ;
  60.     for (int i = 0; i < 5; i++)
  61.     {
  62.         for (int j = 0; j < 5; j++)
  63.         {
  64.             for (int k = 0; k < 5; k++)
  65.             {
  66.                 string jmix = to_string(j1[i])+to_string(j2[j])+to_string(j3[k]);
  67.                 string mmix = to_string(m1[i])+to_string(m2[j])+to_string(m3[k]);
  68.                 if(isDiag) cout << "j mix: " << jmix << ", m mix: " << mmix << endl;
  69.                 dat.insert(jmix);
  70.                 dat.insert(mmix);
  71.             }
  72.         }
  73.         //if(isDiag) cout << "j1-" << i << ": " << j1[i] << ", j2-" << i << ": " << j2[i] << endl;
  74.     }
  75.     ans = dat.size();
  76.    
  77.     if(!isDiag) freopen("combo.out", "w", stdout);
  78.     cout << ans << endl;
  79. }
  80.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement