Guest User

SUBIECT BAC SIMULARE 2014

a guest
Nov 18th, 2019
81
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <string.h>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.  
  8. /* SIMULARE BAC 2014 SI
  9.  
  10. 1) c. 15
  11. 2) a) 1
  12. b) 111, 110, 109
  13. c) done
  14. d)
  15.  
  16.  
  17.  
  18.  
  19. /* SIMULARE BAC 2014 SIII 4
  20.  
  21.  
  22. int maxx = 0, a[80], n = 1, x;
  23. while( cin >> x ){
  24. a[n] = x;
  25. n++;
  26. }
  27. n--;
  28. double nr=0;
  29. for( int i = 1; i < n; i++ ){
  30. int j = 1, p = 10;
  31. nr = 0;
  32. while( j <= n ){
  33. if( j != i && j != i + 1 ){
  34. if( nr == 0 ){
  35. nr = a[j];
  36. }
  37. else{
  38. nr = nr * p + a[j];
  39. }
  40. }
  41. j++;
  42. }
  43. if( nr > maxx ){
  44. maxx = nr;
  45. }
  46. }
  47. cout << maxx;
  48.  
  49. */
  50.  
  51.  
  52. /* SIMULARE BAC 2014 SII 3
  53.  
  54.  
  55. int a[9][9] = {};
  56. for( int i = 0; i < 9; i++ ){
  57. for( int j = 0; j < 9; j++ ){
  58. if( i == j || i + 1 == j || i - 1 == j){
  59. a[i][j] = 2;
  60. }
  61. else{
  62. a[i][j] = 1;
  63. }
  64. }
  65. }
  66. for( int i = 0; i < 9; i++ ){
  67. for( int j = 0; j < 9; j++ ){
  68. cout << a[i][j] << " ";
  69. }
  70. cout << endl;
  71. }
  72.  
  73.  
  74. */
  75.  
  76.  
  77.  
  78. /* SIMULARE BAC 2014 SIII 5
  79.  
  80. char s[100];
  81. cin.getline(s, sizeof(s));
  82. for( int i = 0; i < strlen(s); i++ ){
  83. if( s[i] == 'a' || s[i] == 'e' || s[i] == 'i' || s[i] == 'o' || s[i] == 'u'){
  84. cout << s[i];
  85. }
  86. cout << s[i];
  87. }
  88.  
  89. */
  90. }
RAW Paste Data