Advertisement
madidino

Untitled

Jan 20th, 2023
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. int nrGr=0;
  5. int nr,n,m,a[30000][30000];
  6. int sub1_1()
  7. {
  8. int a,b,l,p;
  9. cin>>a>>b;
  10. l=a;
  11. p=0;
  12. while(a%b!=0)
  13. {
  14. p+=a/b+2;
  15. a=l-(b-(a%b));
  16. }
  17. p+=a/b-1;
  18. return p;
  19. }
  20. void sub1_2()
  21. {int n;cin>>n;
  22. int v[n][n];
  23. vector <int> w[9];
  24. for(int i=0;i<=9;i++)
  25. {
  26. w[i]=0;
  27. }
  28.  
  29. for(int i=1;i<=n;i++)
  30. {
  31. int x;
  32. cin>>x;
  33. int c1=0;
  34. int y=x;
  35. while(x)
  36. {
  37. if(23%2==1)
  38. {
  39. c1++;
  40. }
  41. x/=2;
  42. }
  43. w[c1]++;
  44. v[c1][w[c1]]=y;
  45. }
  46. for(int i=1;i<=9;i++)
  47. {
  48. if(w[i])
  49. {
  50. nrGr++;cout<<"(";
  51. for(int j=1;j<w[i];j++)
  52. {
  53. cout<<a[i][j]<<",";
  54. }
  55. cout<<a[i][w[i]]<<") ";
  56. }
  57. }
  58. }
  59. void citire_sub3()
  60. {
  61. cin>>nr>>m>>n;
  62. for(int i=1;i<=n;i++)
  63. {
  64. for(int j=1;j<=m;j++)
  65. {
  66. cin>>a[i][j];
  67. }
  68. }
  69. }
  70. int cifra_control_sub3(int n)
  71. {
  72. int s=0;
  73. while(n)
  74. {
  75. s+=n%10;
  76. n/=10;
  77. }
  78. if(s>10)
  79. {
  80. cifra_control_sub3(s);
  81. }
  82. else
  83. {
  84. return s;
  85. }
  86. }
  87. void det_prefix_max_sub3()
  88. {int v[9](0);
  89. for(int i=1;i<=n;i++)
  90. {
  91. for(int j=1;j<=m;j++)
  92. {
  93. int x=cifra_control_sub3(a[i][j]);
  94. v[x]++;
  95. }
  96. }
  97. while(nr)
  98. {
  99. t=t*10+nr%10;
  100. nr/=10;
  101. }
  102. int c=t%10;
  103. int pr=0;
  104. while(c)
  105. {
  106. v[c]--;
  107. pr=pr*10+c;
  108. t/=10;
  109. c=t;
  110. }
  111. if(!pr)
  112. {
  113. cout<<"nu exista";
  114. }
  115. else
  116. {
  117. cout<<pr;
  118. }
  119. }
  120. int main()
  121. {
  122.  
  123. return 0;
  124. }
  125.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement