解题思路:
注意事项:
参考代码:
#define CRT_SECURE_NO_WARNINGS #include <iostream> #include <vector> #include <algorithm> #include <math.h> #include <iomanip> //C++输出格式控制 #include <stdio.h> #include <string> using namespace std; int main(int argc, char** argv) { string str = "0"; string newStr; int n = 0; cin >> n; while (n--) { for (string::iterator it = str.begin(); it < str.end(); it++) { if (*it == '0') newStr += '1'; else if (*it == '1') newStr += "01"; } str = newStr; newStr = ""; } cout << str << endl; return 0; }
0.0分
0 人评分
【明明的随机数】 (C++代码)浏览:781 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:687 |
用筛法求之N内的素数。 (C语言代码)浏览:653 |
1908题解浏览:640 |
简单的a+b (C语言代码)浏览:546 |
C语言程序设计教程(第三版)课后习题5.8 (C语言代码)浏览:1175 |
数字游戏 (C++代码)浏览:1185 |
C语言程序设计教程(第三版)课后习题9.4 (C语言代码)浏览:646 |
良心推荐——>题解1049:C语言程序设计教程(第三版)课后习题11.1 (C语言描述——简单明了,时间复杂度低)浏览:1287 |
C语言程序设计教程(第三版)课后习题11.5 (C语言代码)浏览:1000 |