摘要:
思路: 先根据例子找出规律,列出递归要打印的数据; 示例代码: #include <stdio.h> int n = 0; void dg(int x){ int i = 0; if (x != 1) { printf("("); dg(x-1); printf(")"); } for (i = 1 阅读全文
摘要:
示例代码: #include <stdio.h>#include <string.h>#define N 10 char num[N] = {0} ; void yuyin(int n , int x){ if (x == 1 && (n == 9 || n == 5)) { printf("shi 阅读全文
摘要:
思路(贪心): 1.两边往中间逼近,步数少; 2.单个字符出现时只考虑移动到中间的步数,不做移动,因为这是最后进行,不影响结果; 示例代码: #include <stdio.h>#define N 8000 int main(void){ int n = 0 ; int i = 0 , j = 0 阅读全文