Korotkodul

физтех 2

Jan 28th, 2022 (edited)
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. /******************************************************************************
  2.  
  3. Online C++ Compiler.
  4. Code, Compile, Run and Debug C++ program online.
  5. Write your code in this editor and press "Run" button to compile and execute it.
  6.  
  7. *******************************************************************************/
  8.  
  9. #include <iostream>
  10. #include <bits/stdc++.h>
  11. using namespace std;
  12.  
  13. void cs(set <int> v){
  14. for (int x: v){
  15. cout<<x<<' ';
  16. }cout<<"\n";
  17. }
  18.  
  19. void cv(vector <int> v){
  20. for (int x: v){
  21. cout<<x<<' ';
  22. }cout<<"\n";
  23. }
  24.  
  25. int main()
  26. {
  27.  
  28. vector <set <int> > v;
  29. vector <vector <int> > al;
  30. for (int i = 0; i < 72; ++i){
  31. set <int> a;
  32. vector <int> now;
  33. int id = i;
  34. bool was=0;
  35. for (auto s: v){
  36. if (s.find(i) != s.end()){
  37. was=1;
  38. break;
  39. }
  40. }
  41. if (was) continue;
  42. while (a.find(id) == a.end()){
  43. // cout<<"go\n";
  44. a.insert(id);
  45. now.push_back(id);
  46. //cout<<id<<"\n";
  47. id += 32;
  48. id %= 72;
  49. if (a.find(id) != a.end()){
  50. //cout<<id<<"\n";
  51. }
  52. }
  53. //cout<<"a\n";
  54. //cs(a);
  55. al.push_back(now);
  56. v.push_back(a);
  57. }
  58. cout<<"множеств = "<<al.size()<<"\n";
  59. for (auto d: al) cv(d);
  60. }
Add Comment
Please, Sign In to add comment