john2323

Examen de bacalaureat 2020 - Variante propuse - Varianta 2 (Matematica Informatica - Olimpici)

Jan 22nd, 2021
970
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. I.
  2. 1.a.
  3. 2.d.
  4. 3.a
  5. 4.b
  6. 5.c
  7.  
  8. II.
  9. 1.a. 2020
  10.   b. 1234 2345
  11.   c.
  12. #include <iostream>
  13.  
  14. using namespace std;
  15.  
  16. int main()
  17. { int n,m,i,x;
  18. cin>>n;
  19. m=0;
  20. for(int i=1;i<=n;i++)
  21. {
  22.     cin>>x;
  23.     while(x%10>(x/10)%10) x=x/10;
  24.     m=m+x;
  25. }
  26. if(m>0) cout<<m;
  27.   else cout<<"niciunul";
  28.     return 0;
  29. }
  30.  
  31.   d.
  32. citește n (număr natural nenul)
  33.  m=0
  34.  i=1;
  35. ┌cat timp (i<=n)
  36. │ citește x (număr natural)
  37. │┌cât timp x%10 > [x/10]%10 execută
  38. ││ x=[x/10]
  39. │└■
  40. │ m=m+x
  41. │ i++;
  42. └■
  43. ┌dacă m>0 atunci scrie m
  44. │altfel scrie „niciunul”
  45. └■
  46.  
  47.  
  48. 2.
  49. struct figura{ struct {float x,y;}centru;
  50.                float raza;
  51.                }c;
  52.  
  53. 3.
  54. for(i=0;i<7;i++)
  55. for(j=0;j<=j<7;j++)
  56. if(i>j)
  57. a[i][j]="+";
  58. else
  59. if(i==0)
  60. a[i][j]=char("a"+j);
  61. else
  62. a[i][j]=a[i-1][j-1];
  63.  
  64. III.
  65. 1.
  66. int multiplu(int n)
  67. {int ok=0,i=1,cn;
  68. while(ok==0)
  69. {cn=n*i;
  70. if(sqrt(cn)*sqrt(cn)==cn)
  71. return cn;
  72. i++;
  73. }
  74. }
  75.  
  76. 2.
  77. #include <bits/stdc++.h>
  78. using namespace std;
  79. int main()
  80. {char s[101];
  81. int i,n,ok=0;
  82. cin.getline(s,101);
  83. n=strlen(s)+1;
  84. for(i=0;i<n;i++)
  85. {if(s[i]=='<')
  86. ok=1;
  87. if(s[i]=='>')
  88. ok=0;
  89. if(ok==1 && s[i]>='a' && s[i]<='z')
  90. s[i]=char(s[i]-('a'-'A'));}
  91. cout<<s;
  92.     return 0;
  93. }
  94.  
  95.  
  96. 3.
  97. #include <bits/stdc++.h>
  98. using namespace std;
  99. ifstream fin("bac.in");
  100. int main()
  101. {int d,a,aa,c,mini=2e9,cc=0,ok=0;
  102. fin>>aa>>a;
  103. while(fin>>c)
  104. {if(a>aa && a>c)
  105.     {ok=1;
  106.         d=abs(aa-c);
  107. if(d<mini)
  108.     {cc=a;
  109.     mini=d;}
  110. else
  111. if(d==mini)
  112.     cc=max(cc,a);}
  113. aa=a;
  114. a=c;
  115. }
  116. if(ok==1)
  117. cout<<cc;
  118. else
  119. cout<<"NU EXISTA";
  120.     return 0;
  121. }
  122.  
  123.  
RAW Paste Data