Advertisement
Guest User

coduri

a guest
Jan 20th, 2020
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.66 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. ifstream fin("coduri.in");
  6. ofstream fout("coduri.out");
  7.  
  8. void baza2(int n)
  9. {
  10.     int n10=0, n2=0, p=1;
  11.     while(n)
  12.     {
  13.         n10+=p*(int(n))%10;
  14.         p*=16;
  15.         n/=10;
  16.     }
  17.     deque<int>a(1);
  18.     while(n10)
  19.         a.push_front(n10%10), n/=10;
  20.     for(int i=1;i<a.size();++i) fout << a[i];
  21.     fout << "\n";
  22. }
  23.  
  24. void baza16(int n)
  25. {
  26.  
  27. }
  28.  
  29. int main()
  30. {
  31.     int n, H, B, nr;
  32.     char Cod;
  33.     fin >> n >> H >> B;
  34.     for(int i=1;i<=n;++i)
  35.     {
  36.         fin >> Cod;
  37.         if(Cod=='H') fin >> nr, baza2(nr);
  38.         if(Cod=='D') fin >> nr, baza16(nr);
  39.  
  40.     }
  41.     return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement