Advertisement
Anik_Akash

ans -4 search data

Oct 7th, 2021
555
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.55 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace    std;
  3.  
  4. #define flush                    cin.ignore(numeric_limits<streamsize>::max(),'\n')
  5. #define FASTERIO                 ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
  6. #define NL                       cout<<'\n';
  7. #define pi                       acos(-1.0) //3.1415926535897932384626
  8. #define pb                       push_back
  9. #define mk                       make_pair
  10. #define mx                       1000005
  11. #define EPS                      1e-10
  12. #define dpoint(x)                fixed<<setprecision(x)
  13. # define my_sizeof(type) ((char *)(&type+1)-(char*)(&type))
  14. typedef long long int            ll;
  15. typedef double                   dl;
  16. typedef unsigned long long int   ull;
  17.  
  18. int main() {
  19.  
  20. #ifdef anikakash
  21.     clock_t tStart = clock();
  22.     freopen("input.txt", "r", stdin);
  23.     freopen("tmp.txt", "w", stdout);
  24. #endif
  25.  
  26.     FASTERIO; //cmt when use scanf & printf ;
  27.  
  28.     int arr[10];
  29.     int cnt = 0;
  30.     bool vis[10];
  31.     int n; cin >> n;
  32.  
  33.     for (int i = 0; i < n; i++)cin >> arr[i];
  34.     for(int i=0; i<10; i++)vis[i]=false;
  35.  
  36.  
  37.             cnt = 0;
  38.             int KEY; cin>>KEY;
  39.             for (int j = 0; j < n; j++) {
  40.                 if (KEY == arr[j]) {
  41.                     vis[j] = true;
  42.                     cnt++;
  43.                 }
  44.             }
  45.            cout << KEY << " is found " << cnt<< " times in your list" << endl;
  46.        
  47.    
  48.  
  49. #ifdef anikakash
  50.     fprintf(stderr, "\n>> Runtime: %.10fs\n", (double) (clock() - tStart) / CLOCKS_PER_SEC);
  51. #endif
  52.  
  53.     return 0;
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement