Advertisement
Zeinab_Hamdy

Untitled

Mar 27th, 2023
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.08 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define ull unsigned ll
  5. #define nl "\n"
  6. #define sz(x) int(x.size())
  7. #define NumOfDigit(w) log10(w) + 1
  8. #define fill(arr, val)  memset(arr, val , sizeof(arr))
  9. #define PI 3.141592654
  10. #define ceil(w, m) (((w) / (m)) + ((w) % (m) ? 1 : 0))
  11. #define all(v) v.begin(), v.end()
  12. #define rall(v) v.rbegin(), v.rend()
  13. #define fi first
  14. #define se second
  15. #define cin(v) for (auto&i:v) cin >> i;
  16. #define cout(v) for (auto&i:v) cout << i << " ";
  17. #define fixed(n) fixed << setprecision(n)
  18. //#define MOD  1e9 + 7
  19.  
  20.  
  21. void IO(){
  22.     ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
  23. }
  24. void files(){
  25.     //freopen("filename.in" , "r" ,stdin);
  26.             #ifndef ONLINE_JUDGE
  27.               freopen("input.txt", "r", stdin);  freopen("output.txt", "w", stdout);
  28.             #endif
  29. }
  30.  
  31. void solve(){
  32.  
  33. int n ;
  34. cin >> n ;
  35.  
  36. vector < vector < vector < int > > > arr(n, vector<vector< int  > >(5, vector< int >(5)));
  37.  
  38. for(int i=0 ; i < n ; i++){
  39.  
  40.     for(int j =0 ; j < 5 ; j++){
  41.           int x ;
  42.         cin >> x;
  43.         bitset < 32 > bit(x);
  44.        // cout << bit ;
  45.        if( x == 32 ){
  46.            arr[i][j][0]='*' ;
  47.            for(int q = 1 ; q < 5 ;q++) arr[i][j][q]=' ';
  48.        }
  49.        else {
  50.            int id=0;
  51.            for(int e= 0 ; e  < 5  ; e++){
  52.               // cout << bit[e];
  53.                arr[i][j][e]= bit[e];
  54.               // if( bit[e]=='1') arr[i][j][id++]='*';
  55.               // else arr[i][j][id++]=' ';
  56.            }
  57.            reverse(all(arr[i][j]));
  58.        }
  59.        
  60.       // cout(arr[i][j]);
  61.       // cout << nl;
  62.     }
  63. }
  64.  
  65. for(int i=0 ; i < 5 ; i++){
  66.     for(int j = 0 ; j < n ; j++){
  67.        
  68.        for(auto& x : arr[j][i]){
  69.            if(x==1) cout<<'*';
  70.            else cout <<" ";
  71.        }
  72.         cout << ' ';
  73.     }
  74.     cout << nl;
  75. }
  76.  
  77.  
  78.  
  79.  
  80. }
  81.  
  82. int main(){
  83.                  IO();       //  files();
  84.  
  85.     int testCase=1;  // one test case
  86.     //cin >> testCase ;      
  87.  while(testCase--)
  88.         solve();  // my code
  89.        
  90.     return 0;
  91. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement