john2323

varianta 8 Paralela 45 (INFO)

Jan 20th, 2021 (edited)
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.90 KB | None | 0 0
  1. Teza 8
  2.  
  3. I.
  4. 1.b.
  5. 2.c.
  6. 3.a
  7. 4.b
  8. 5.c.
  9.                                *f(6)
  10.      *cout<<6            *f(1)           *f(2)                      *f(3)
  11.                 *cout<<1     -    *cout<<2     *f(1)      *cout<<3           *f(1)
  12.                                         *cout<<1    -              *cout<<1      -
  13.  
  14. II.
  15.   1.a.16
  16.     b.6
  17.     c.
  18. #include<iostream>
  19. using namespace std;
  20. int main()
  21. {int x,y,i;
  22. cin>>x;
  23. y=0;
  24. for(i=1;i<=x/2;i++)
  25. if(x%i==0)
  26. y=y+i;
  27.  
  28. if(y==x)
  29. cout<<1<<' '<<x;
  30. else
  31. cout<<y;
  32. }
  33.  
  34.     d.
  35. citeste x
  36. (x numar natural, x!=1)
  37. y=0
  38. i=0
  39.  ┌cat timp i<=x/2 executa
  40.  │ ┌daca x%i=0 atunci
  41.  │ │ y=y+i
  42.  │ └■
  43.  │ i=i+1
  44.  └■
  45.  ┌ daca y=x atunci
  46.  │  scrie 1,' ',x
  47.  │ altfel
  48.  │  scrie y
  49.  └■
  50.   2.if((t.a == t.b && t.a != t.c)||(t.a == t.c && t.a != t.b) ||(t.b == t.c && t.b != t.a))
  51.   3.
  52. n=0;
  53. for(i=1;i<=5;i++)
  54. {cin>>s;
  55. if(s[1]==2 && s[2]==0 && s[3]==1 && s[4]==9)
  56. n++;
  57. }
  58.  
  59. III.
  60.   1.
  61. #include <iostream>
  62.  
  63. using namespace std;
  64.  
  65. int main()
  66. {int a[11][11],i,j,n,nr;
  67. cin>>n;
  68. for(i=1;i<=n;i++)
  69.     for(j=1;j<=n;j++)
  70.     cin>>a[i][j];
  71. for(i=1;i<=n;i++)
  72.     {nr=0;
  73.     for(j=1;j<=n;j++)
  74. nr=nr*2+a[i][j];
  75.     cout<<nr<<" ";}
  76.  
  77.     return 0;
  78. }
  79.  
  80.   2.
  81. #include <iostream>
  82. #include <cmath>
  83. using namespace std;
  84.  
  85. int patrat(int n)
  86. {int i,p,maxi=0;
  87. for(i=1;i*i<=n;i++)
  88.     if(n%i==0)
  89.     {if (sqrt(i)*sqrt(i)==i && i>maxi)
  90.     maxi=i;
  91.         if(i*i<n)
  92.         if(sqrt(n/i)*sqrt(n/i)==n/i && n/i>maxi)
  93.         maxi=n/i;}
  94. return maxi;
  95. }
  96.  
  97. int main()
  98. {int n;
  99. cin>>n;
  100. cout<<patrat(n);
  101.     return 0;
  102. }
  103.  
  104.   3.
  105. #include <iostream>
  106. #include <fstream>
  107. using namespace std;
  108. ifstream fin("BAC.TXT");
  109. int main()
  110. {int x,s5=0,maxi=2e-9,cx,ap;
  111. while(fin>>x)
  112. {cx=x;
  113. s5=0;
  114.     while(cx)
  115.     {s5=s5+cx/5;
  116.      cx/=5;}
  117. if(s5>maxi)
  118.     {ap=1;
  119.     maxi=s5;}
  120. else
  121. if(s5==maxi)
  122. ap++;
  123.  
  124. }
  125.  cout<<ap<<" "<<maxi;
  126.     return 0;
  127. }
  128.  
  129.  
Add Comment
Please, Sign In to add comment