楼主:
oin1104 (是oin的说)
2024-09-08 13:01:33家人们
我这次3000名
徽章++
q1
把日期的字串 变成 二进制的字串
思路
照做
```cpp
class Solution {
public:
string convertDateToBinary(string date)
{
int a = stoi(date.substr(0,4));
int b = stoi(date.substr(5,2));
int c = stoi(date.substr(8,2));
string res ;
string tmp;
while(a>0)
{
tmp.push_back((a&1)+'0');
a>>=1;
}
for(int i = tmp.size()-1 ; i >= 0 ; i