摘要: Think before you code Many novice programmers attempt to dive right into writing the code (in the programming language) as the first step. However, wr 阅读全文
posted @ 2022-10-29 18:53 WooPooW 阅读(18) 评论(0) 推荐(0)
摘要: 排列枚举 P1706 全排列问题,P1088 火星人 思路: 1.搜索(未学习) 2.STL:next_permutation(start,end) 生成一个在[start,end)内存的数组严格按照字典序的下一个排列,且当为最大值时返回0 I:手写(待补充) 补充: 1.对于全排列的升序输出STL 阅读全文
posted @ 2020-07-24 18:41 WooPooW 阅读(405) 评论(0) 推荐(0)
摘要: 深基: P1-1 判断完全平方数 1.暴力枚举每个数直到sqrt(n),不要直接sqrt如果超出1-6e则会误判 2.根据等差数列 代码: 1.bool is_square(int n){ for(int i = 1;i * i <= n;i++) if(i*i == n) return true; 阅读全文
posted @ 2020-07-17 21:14 WooPooW 阅读(208) 评论(0) 推荐(0)
摘要: 目前只使用字符数组P1914 小书童——密码 思路: 1.利用字符串结尾为'\0'停止循环 2.循环相对位置(位置成环?)利用取模运算 for(int i = 0;s[i];i++)putchar((s[i]-'a'+n)%26 + 'a'); P5733 【深基6.例1】自动修正 思路: 1.利用 阅读全文
posted @ 2020-07-16 20:29 WooPooW 阅读(470) 评论(0) 推荐(0)