fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int k,kol=0,n,m,i,j;
  6. int a[100][100];
  7. cin>>n>>m;
  8. for(i=0;i<n;i++){
  9. for(j=0;j<m;j++){
  10. cin>>a[i][j];
  11. }
  12. }
  13. cin>>k;
  14. for(i=0;i<n;i++){
  15. for(j=0;j<m;j++){
  16. if(a[i][j]==k){
  17. kol++;
  18. }
  19. }
  20. }
  21. cout<<kol;
  22. return 0;
  23. }
Success #stdin #stdout 0s 4952KB
stdin
4 5
1 2 3 4 5
6 12 8 9 10
11 12 12 14 15
16 17 18 12 20
12
stdout
4