-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathByte to Bit_2.cpp
46 lines (43 loc) · 981 Bytes
/
Byte to Bit_2.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include<bits/stdc++.h>
#define ll long long
#define fo(i,n) for(int i=0;i<n;i++)
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin>>t;
while(t--)
{
int n,daycount=2,curr=0;
cin>>n;
ll nBit=1,nNibble=0,nByte=0;
while(daycount<n)
{
if(daycount-curr==2)
{
nNibble=nBit;
nBit=0;
curr=daycount;
daycount+=8;
}
else if(daycount-curr==8)
{
nByte=nNibble;
nNibble=0;
curr=daycount;
daycount+=16;
}
else if(daycount-curr==16)
{
nBit=2*nByte;
nByte=0;
curr=daycount;
daycount+=2;
}
// daycount+=2;
}
cout<<nBit<<" "<<nNibble<<" "<<nByte<<"\n";
}
}