其他分享
首页 > 其他分享> > 第九届蓝桥杯-明码

第九届蓝桥杯-明码

作者:互联网

 1 #include <iostream>
 2 #include <bitset>
 3 using namespace std;
 4 int main()
 5 {
 6     int n,m;
 7     int len;
 8     string temp;
 9     bitset<8> t;
10     while(cin>>n>>m)
11     {
12         t = n;
13         temp = t.to_string();
14         len = temp.length();
15         for(int i = 0; i < len; i++)
16         {
17             if(temp[i]=='0')
18             {
19                 cout << " ";
20             }
21             else
22             {
23                 cout << "*";
24             }
25         }
26         t = m;
27         temp = t.to_string();
28         len = temp.length();
29         for(int i = 0; i < len; i++)
30         {
31             if(temp[i]=='0')
32             {
33                 cout << " ";
34             }
35             else
36             {
37                 cout << "*";
38             }
39         }
40         cout << endl;
41  
42  
43     }
44  
45 }
46 /*
47 测试数据
48 4 0 4 0 4 0 4 32 -1 -16 4 32 4 32 4 32 4 32 4 32 8 32 8 32 16 34 16 34 32 30 -64 0 
49 16 64 16 64 34 68 127 126 66 -124 67 4 66 4 66 -124 126 100 66 36 66 4 66 4 66 4 126 4 66 40 0 16 
50 4 0 4 0 4 0 4 32 -1 -16 4 32 4 32 4 32 4 32 4 32 8 32 8 32 16 34 16 34 32 30 -64 0 
51 0 -128 64 -128 48 -128 17 8 1 -4 2 8 8 80 16 64 32 64 -32 64 32 -96 32 -96 33 16 34 8 36 14 40 4 
52 4 0 3 0 1 0 0 4 -1 -2 4 0 4 16 7 -8 4 16 4 16 4 16 8 16 8 16 16 16 32 -96 64 64 
53 16 64 20 72 62 -4 73 32 5 16 1 0 63 -8 1 0 -1 -2 0 64 0 80 63 -8 8 64 4 64 1 64 0 -128 
54 0 16 63 -8 1 0 1 0 1 0 1 4 -1 -2 1 0 1 0 1 0 1 0 1 0 1 0 1 0 5 0 2 0 
55 2 0 2 0 7 -16 8 32 24 64 37 -128 2 -128 12 -128 113 -4 2 8 12 16 18 32 33 -64 1 0 14 0 112 0 
56 1 0 1 0 1 0 9 32 9 16 17 12 17 4 33 16 65 16 1 32 1 64 0 -128 1 0 2 0 12 0 112 0 
57 0 0 0 0 7 -16 24 24 48 12 56 12 0 56 0 -32 0 -64 0 -128 0 0 0 0 1 -128 3 -64 1 -128 0 0
58 */ 

 

标签:第九届,string,temp,int,明码,len,蓝桥,include
来源: https://www.cnblogs.com/CodingLife-190505/p/12362945.html