SHARE
TWEET

Untitled

a guest Nov 12th, 2019 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -------nr1------
  2. 1
  3. int count(int a[101], int n)
  4. {
  5.     int med;
  6.     int nr = 0;
  7.     int s = 0;
  8.     for(int i = 1; i <= n; ++i) s += a[i];
  9.     med = s / n;
  10.     for(int i = 1; i <= n; ++i){
  11.         if(a[i] >= med) ++nr;
  12.     }
  13.     return nr;
  14. }
  15.  
  16. 2
  17. void sterge(int v[101], int &n, int i)
  18. {
  19.     for(int j = i; j < n; ++j){
  20.         v[j] = v[j+1];
  21.     }
  22.     --n;
  23. }
  24.  
  25. 3
  26. int primul(int a)
  27. {
  28.     for(int i = 2; i <= a / 2; ++i){
  29.         if(a % i == 0) return i;
  30.     }
  31.     return a;
  32. }
  33.  
  34. 5
  35. int main()
  36. {
  37.     cin.getline(s, 300);
  38.     char* p = strtok(s, " ");
  39.     cout << p;
  40. }
  41.  
  42. 6
  43. int main()
  44. {
  45.     cin.getline(s, 300);
  46.     char* p = strtok(s, "*");
  47.     while(p != NULL){
  48.         int n = strlen(p);
  49.         for(int i = 0; i < n; ++i){
  50.             if(p[i] == p[i+1]) cout << p[i] << p[i] << '\n';
  51.         }
  52.         p = strtok(NULL, "*");
  53.     }
  54. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top