Advertisement
Guest User

Untitled

a guest
Feb 27th, 2020
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <sstream>
  4. #include <cmath>
  5.  
  6. using namespace std;
  7.  
  8. int main(int argc, char** argv) {
  9. ifstream fin("dane.txt");
  10. int tab[200][320];
  11. int ti = 0;
  12. while(!fin.eof())
  13. {
  14. string linia;
  15. for(int j=0;j<320;j++)
  16. {
  17. fin>>tab[ti][j];
  18. }
  19. string liczba = "";
  20.  
  21. ti++;
  22. }
  23.  
  24.  
  25.  
  26. int ile = 0;
  27. for(int i=0;i<200;i++)
  28. {
  29.  
  30. for(int j=0;j<160;j++)
  31. {
  32. if(tab[i][159-j]!=tab[i][160+j])
  33. {
  34. ile++;
  35. break;
  36. }
  37. }
  38. }
  39.  
  40. cout<<ile;
  41.  
  42. for(int i=0;i<200;i++)
  43. {
  44.  
  45. for(int j=0;j<160;j++)
  46. {
  47. if(tab[i][159-j]!=tab[i][160+j])
  48. {
  49. ile++;
  50. break;
  51. }
  52. }
  53. }
  54.  
  55.  
  56. int ile_kontr = 0;
  57. for(int i=0;i<200;i++)
  58. {
  59. for(int j=0;j<360;j++)
  60. {
  61. if(abs(tab[i][j]-tab[i][j+1])>128)ile_kontr++;
  62. }
  63. }
  64.  
  65. for(int i=0;i<199;i++)
  66. {
  67. for(int j=0;j<359;j++)
  68. {
  69. if(abs(tab[i][j]-tab[i+1][j])>128)ile_kontr++;
  70. }
  71. }
  72.  
  73. cout<<endl<<ile_kontr;
  74.  
  75. cout<<endl;
  76.  
  77. int najdl = 1;
  78. int najdl2 = 1;
  79. for(int i=0;i<320;i++)
  80. {
  81. for(int j=0;j<199;j++)
  82. {
  83. if(tab[j][i]==tab[j+1][i])
  84. {
  85. najdl++;
  86. }else{
  87. if(najdl>najdl2)najdl2 = najdl;
  88. najdl = 1;
  89. }
  90. }
  91. }
  92.  
  93. cout<<najdl2;
  94. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement