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. for (j = 0; j < m; j++)
  12. for (i = 0; i < n; i++)
  13. if (a[i,j]==0) {cout<<j+1; i=n; j=n;}
  14. /*f= n*m;
  15.   Type *a1 = new Type [f];
  16.   unnul = 0; k = 0;
  17.   for (i = 0; i < n; i++) {
  18.   for (j = 0; j < m; j++)
  19.   {if (a[i][j] == 0) k++;}
  20.   if (k==0) unnul++; k = 0;}
  21.  
  22.   k=0;
  23. for (i = 0; i < n; i++)
  24.   for (j = 0; j < m; j++)
  25.   {a1[k]=a[i][j]; k++;}
  26.  
  27. for (i=0; i<f; i++)
  28.   for (j=0; j<f; j++)
  29.   if (a1[j] > a1[j+1])
  30. {
  31.   tmp = a1[j];
  32.   a1[j] = a1[j+1];
  33.   a1[j+1] = tmp;
  34. }
  35. for(i=f; i>=0; i--)
  36. {
  37. if(a1[i] == a1[i-1])
  38. {
  39. jey = a1[i];
  40. break;
  41. }
  42. }
  43. cout<<unnul<<".";
  44. for(i = 1; i<=ph;i++)
  45. cout<<"0";
  46. cout<<" "<< fixed << setprecision(ph) << jey<<endl;
  47. ph +=2;*/
  48. return 0;
  49. }
  50.  
  51. int m1( )
  52. {
  53. int i,j,unnul,k,f; int tmp; bool p;
  54. int **a = new int *[n];
  55. ph = 0;
  56. for (i = 0; i < n; i++) a[i] = new int [m];
  57. for (i = 0; i < n; i++)
  58. for (j = 0; j < m; j++)
  59. cin >> a[i][j];
  60. q=0;
  61. cosh(a,n,m,q);
  62.  
  63. return 0;
  64. }
  65.  
  66. int m2( )
  67. {
  68. int i,j,unnul,k,f; int tmp; bool p;
  69. float **a = new float *[n];
  70.  
  71. for (i = 0; i < n; i++) a[i] = new float [m];
  72. for (i = 0; i < n; i++)
  73. for (j = 0; j < m; j++)
  74. cin >> a[i][j];
  75. q=1;
  76. cosh(a,n,m,q);
  77.  
  78. return 0;
  79. }
  80.  
  81. int m3( )
  82. {
  83. int i,j,unnul,k,f; int tmp; bool p;
  84. float **a = new float *[n];
  85.  
  86. for (i = 0; i < n; i++) a[i] = new float [m];
  87. for (i = 0; i < n; i++)
  88. for (j = 0; j < m; j++)
  89. cin >> a[i][j];
  90. q=2;
  91. cosh(a,n,m,q);
  92.  
  93. return 0;
  94. }
  95.  
  96. int main()
  97. {
  98. cin >> n >> m;
  99. m1(); m2(); m3();
  100. return 0;
  101. }
  102.  
Success #stdin #stdout 0s 15240KB
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