fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int m,n,k,i,j,d=0,maxx=0,t=0,x,kt=0;
  5. int a[1005][1005];
  6. void nhap()
  7. {
  8. cin>>m>>n>>k;
  9. for (i=1;i<=m;i++)
  10. for (j=1;j<=n;j++) cin>>a[i][j];
  11. }
  12. void cau_a()
  13. {
  14. int s=0;
  15. for (i=1;i<=n;i++) s+=a[k][i];
  16. cout<<s<<endl;
  17. }
  18. void cau_b()
  19. {
  20. int d=0;
  21. for (i=1;i<=m;i++)
  22. if (a[i][k]%2==0) d++;
  23. cout<<d<<endl;
  24. }
  25. void cau_c()
  26. {
  27. int maxx = 0;
  28. int hmax=0;
  29. for (i=1;i<=m;i++)
  30. {
  31. t=0;
  32. for(j=1;j<=n;j++) t+=a[i][j];
  33. if (t>maxx)
  34. {
  35. maxx=t;
  36. hmax=i;
  37. }
  38. }
  39. cout<<hmax<<endl;
  40. }
  41. void cau_d()
  42. {
  43. bool kt=true;
  44. for (i=1;i<=m;i++)
  45. {
  46. if(a[i][k]%2==1)
  47. {
  48. kt=false;
  49. break;
  50. }
  51. }
  52. if (kt==false) cout<<"no";
  53. else cout<<"yes";
  54. }
  55.  
  56. int main()
  57. {
  58. nhap();
  59. cau_a();
  60. cau_b();
  61. cau_c();
  62. cau_d();
  63. }
  64.  
Success #stdin #stdout 0.01s 5284KB
stdin
3 5 2
3 -4 3 6 3
-2 4 6 2 -4
2 6 4 1 -2
stdout
6
3
1
yes