Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<fstream>
- using namespace std;
- ifstream fin("paritate.in");
- ofstream fout("paritate.out");
- char v[60001];
- char a[3005];
- int y[305];
- long long trece( long long x2)
- {
- long long cifra, p2=1, x10=0;
- while(x2)
- {
- cifra=x2%10;
- x10=x10+cifra*p2;
- p2=p2*2;
- x2=x2/10;
- }
- return x10;
- }
- int main()
- {
- int i=1, x, contor=0, ascii, prima,da=0, p=1, g, l=0, c=0, k;
- char aux=0,litera;
- while(fin>>v[i])
- {
- v[i]=v[i]-48;
- i++;
- }
- for(int j=1; j<=i-1; j=j+8)
- {
- prima=v[j];
- for( k=j+1; k<=j+7; k++)
- {
- x=v[k];
- aux=aux*10+x;
- p=p*10;
- if(v[k]==1)
- {
- contor++;
- }
- }
- ascii=trece(aux);
- fout<<ascii<<" ";
- if(contor%2==prima)
- {
- //da++;
- a[l]=litera;
- l++;
- }
- else
- {
- y[c]=j;
- c++;
- }
- p=1;
- aux=0;
- contor=0;
- }
- // if(y[1]!=0)
- // {
- // fout<<"NU";
- // for(int g=0; g<=c; g++)
- // {
- // fout<<y[c]<<" ";
- // }
- // }
- // else
- // {
- // fout<<"DA";
- // for( g=0; g<=l; g++)
- // {
- // fout<<a[g]<<" ";
- //
- // }
- // }
- fin.close();
- fout.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement