fork download
  1. #include<stdio.h>
  2. int main()
  3. {
  4. int m,n;
  5. scanf("%d %d", &m,&n);
  6. int arr1[m][n];
  7. for(int i=0;i<m;i++){
  8. for(int j=0;j<n;j++){
  9. scanf("%d", &arr1[i][j]);
  10. }
  11. }
  12. int p,q;
  13. scanf("%d%d",&p,&q);
  14. int arr2[p][q];
  15. for(int i=0;i<p;i++){
  16. for(int j=0;j<q;j++){
  17. scanf("%d", &arr2[i][j]);
  18. }
  19. }
  20. int x;
  21. int count=0;
  22. scanf("%d",&x);
  23. for(int i=0;i<m;i++){
  24. for(int j=0;j<n;j++){
  25. for(int k=0;k<p;k++){
  26. for(int l=0;l<q;l++){
  27. if((arr1[i][j]+arr2[k][l])==x){
  28. count++;
  29. }
  30. }
  31. }
  32. }
  33. }
  34.  
  35. printf("%d", count);
  36. }
Success #stdin #stdout 0s 5280KB
stdin
Standard input is empty
stdout
Standard output is empty