Advertisement
cupsamada

...

Feb 18th, 2020
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. #include<iostream>
  2. #include<fstream>
  3. using namespace std;
  4. ifstream fin("paritate.in");
  5. ofstream fout("paritate.out");
  6. char v[60001];
  7. char a[3005];
  8. int y[305];
  9. long long trece( long long x2)
  10. {
  11. long long cifra, p2=1, x10=0;
  12. while(x2)
  13. {
  14. cifra=x2%10;
  15. x10=x10+cifra*p2;
  16. p2=p2*2;
  17. x2=x2/10;
  18. }
  19. return x10;
  20. }
  21. int main()
  22. {
  23. int i=1, x, contor=0, ascii, prima,da=0, p=1, g, l=0, c=0, k;
  24. char aux=0,litera;
  25.  
  26. while(fin>>v[i])
  27. {
  28.  
  29. v[i]=v[i]-48;
  30. i++;
  31. }
  32. for(int j=1; j<=i-1; j=j+8)
  33. {
  34. prima=v[j];
  35. for( k=j+1; k<=j+7; k++)
  36. {
  37. x=v[k];
  38. aux=aux*10+x;
  39. p=p*10;
  40. if(v[k]==1)
  41. {
  42. contor++;
  43. }
  44. }
  45. ascii=trece(aux);
  46. fout<<ascii<<" ";
  47. if(contor%2==prima)
  48. {
  49. //da++;
  50.  
  51. a[l]=litera;
  52. l++;
  53. }
  54. else
  55. {
  56. y[c]=j;
  57. c++;
  58. }
  59. p=1;
  60. aux=0;
  61. contor=0;
  62. }
  63. // if(y[1]!=0)
  64. // {
  65. // fout<<"NU";
  66. // for(int g=0; g<=c; g++)
  67. // {
  68. // fout<<y[c]<<" ";
  69. // }
  70. // }
  71. // else
  72. // {
  73. // fout<<"DA";
  74. // for( g=0; g<=l; g++)
  75. // {
  76. // fout<<a[g]<<" ";
  77. //
  78. // }
  79. // }
  80.  
  81. fin.close();
  82. fout.close();
  83. return 0;
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement