fork(1) download
  1. #include <iostream>
  2. #include<math.h>
  3. #include <iomanip>
  4. using namespace std;
  5. int n,m,q,ph;
  6. template<typename Type>
  7.  
  8. int cosh(Type **a, const int n, const int m,int q){
  9. int i,j,unnul,k,f; int tmp; bool p; Type jey;
  10. cout<<"\n";
  11. cout<<a[1,1];
  12. for (j = 0; j < m; j++)
  13. for (i = 0; i < n; i++)
  14. if (a[i,j]==0) {cout<<a[i,j]; i=n; j=n;}
  15. /*f= n*m;
  16.   Type *a1 = new Type [f];
  17.   unnul = 0; k = 0;
  18.   for (i = 0; i < n; i++) {
  19.   for (j = 0; j < m; j++)
  20.   {if (a[i][j] == 0) k++;}
  21.   if (k==0) unnul++; k = 0;}
  22.  
  23.   k=0;
  24. for (i = 0; i < n; i++)
  25.   for (j = 0; j < m; j++)
  26.   {a1[k]=a[i][j]; k++;}
  27.  
  28. for (i=0; i<f; i++)
  29.   for (j=0; j<f; j++)
  30.   if (a1[j] > a1[j+1])
  31. {
  32.   tmp = a1[j];
  33.   a1[j] = a1[j+1];
  34.   a1[j+1] = tmp;
  35. }
  36. for(i=f; i>=0; i--)
  37. {
  38. if(a1[i] == a1[i-1])
  39. {
  40. jey = a1[i];
  41. break;
  42. }
  43. }
  44. cout<<unnul<<".";
  45. for(i = 1; i<=ph;i++)
  46. cout<<"0";
  47. cout<<" "<< fixed << setprecision(ph) << jey<<endl;
  48. ph +=2;*/
  49. return 0;
  50. }
  51.  
  52. int m1( )
  53. {
  54. int i,j,unnul,k,f; int tmp; bool p;
  55. int **a = new int *[n];
  56. ph = 0;
  57. for (i = 0; i < n; i++) a[i] = new int [m];
  58. for (i = 0; i < n; i++)
  59. for (j = 0; j < m; j++)
  60. cin >> a[i][j];
  61. q=0;
  62. cosh(a,n,m,q);
  63.  
  64. return 0;
  65. }
  66.  
  67. int m2( )
  68. {
  69. int i,j,unnul,k,f; int tmp; bool p;
  70. float **a = new float *[n];
  71.  
  72. for (i = 0; i < n; i++) a[i] = new float [m];
  73. for (i = 0; i < n; i++)
  74. for (j = 0; j < m; j++)
  75. cin >> a[i][j];
  76. q=1;
  77. cosh(a,n,m,q);
  78.  
  79. return 0;
  80. }
  81.  
  82. int m3( )
  83. {
  84. int i,j,unnul,k,f; int tmp; bool p;
  85. float **a = new float *[n];
  86.  
  87. for (i = 0; i < n; i++) a[i] = new float [m];
  88. for (i = 0; i < n; i++)
  89. for (j = 0; j < m; j++)
  90. cin >> a[i][j];
  91. q=2;
  92. cosh(a,n,m,q);
  93.  
  94. return 0;
  95. }
  96.  
  97. int main()
  98. {
  99. cin >> n >> m;
  100. m1(); m2(); m3();
  101. return 0;
  102. }
  103.  
Success #stdin #stdout 0s 15232KB
stdin
3 4
-2 0 4 7
7 -8 -1 5
0 -3 4 1
1.849 -3 0.01 2
-0.05 9 2 -1.555
0 2.12 9 1
0.1234 0 -7.602 -8.54
1 4.00005 1.99 -2
6.02207 1 -1 0
stdout
0x2b44819b3c70
0x2b44819b4d00
0x2b44819b4dd0