1. Title Description: Click to open the link
2. Solving ideas: The problem is solved by scanning method. At first I wanted to be complicated, and all the 01 figures were listed and tried. The result has not been able to write at the end, gave up. After the game it is very simple to find ideas. Think of each digit as the height of a pillar, scanned by layer. If the number of the J bit is greater than the current layer I, then this bit is set to 1, otherwise it is set to 0. It can be found that the final answer is the largest digit in the number entered, and the value of each bit can be easily implemented using a string.
What is worth learning is the use of the Max_element function and the Atoi function.
3. Code:
#define _crt_secure_no_warnings #include <iostream> #include <algorithm> #include <string> #include <sstream> #include <set> #include <vector> #include <stack> #include <map> #include < queue> #include <deque> #include <cstdlib> #include <cstdio> #include <cstring> #include < cmath> #include <ctime> #include <functional>using namespace std;vector<string>ans;string str; int main () {//freopen ("T.txt", "R", stdin), while (Cin >> str) {ans.clear (); int k = *max_element (Str.begin (), Str.end ())-' 0 '; cout << k << endl;for (int i = 0; i < K; i++)//Layer-wise Scan {string s;for (int j = 0; J < Str.size (); j + +) S + = (I < (str[j]-' 0 '))? ' 1 ': ' 0 '; cout << atoi (S.c_str ()) << ';} cout << Endl;} return 0;}
#300 (Div.1 2) b. Quasi Binary