上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 22 下一页
摘要: // // Created by snnnom on 2020/9/5. // #include <iostream> #include <stack> #include <vector> #include <math.h> #include <string> #include <stack> #i 阅读全文
posted @ 2020-09-23 08:37 安之若醇 阅读(113) 评论(0) 推荐(0) 编辑
摘要: 想吐槽一句,我是多少年没有看字符串了呀,,,,,居然真就.... 1 class Solution { 2 public: 3 int repeatedStringMatch(string A, string B) { 4 5 int ans = 1; 6 string tmp = A; 7 int 阅读全文
posted @ 2020-09-17 22:49 安之若醇 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 九月首发,教师节快乐呀! 这个题,数字可以重复选,那就直接回溯呀!!! class Solution{ vector<int> res; vector<vector<int>> ans; public: void combine(vector<int>& candidates, int target 阅读全文
posted @ 2020-09-10 16:43 安之若醇 阅读(178) 评论(0) 推荐(0) 编辑
摘要: cin.get(); fflush(stdin); 阅读全文
posted @ 2020-08-31 10:42 安之若醇 阅读(390) 评论(0) 推荐(0) 编辑
摘要: 最近忙考试,,,有亿点点累哦,这边也没咋更.不过,我回来啦 代码能力又下降了不少(小白落泪) 今天才知道,如果 在string 后添加一个字符可以用str+="c" 但是去掉一个字符就不行 那怎么去 //方法:使用erase() str.erase(str.end() - 1); cout << s 阅读全文
posted @ 2020-08-30 10:40 安之若醇 阅读(1026) 评论(0) 推荐(0) 编辑
摘要: 就是那个位运算,,,,,我又想多了emmmmm' 其实不同的位对应不同的递归而已 那个& 别弄错逻辑 如果有,就不能走!!! 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 5 using namespace std; 6 阅读全文
posted @ 2020-07-29 16:37 安之若醇 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 我感觉到了是dfs,但是我不是很会搞它(2017年题好难啊!!!) 本小白以为也是跟以前的连通块似的,按格子来找坐标 后来发现不太行 而且一定要注意根据对称性会有四个是一样的,如果按格子来的话很难判断 所以这个题是看分割线的 从中心点往左走,然后右边的也一起标记(因为对称) 最后的答案要除以4,因为 阅读全文
posted @ 2020-07-29 15:48 安之若醇 阅读(163) 评论(0) 推荐(0) 编辑
摘要: bfs通解,,,用了set存放状态以保证第一次找到目标答案 1 // 2 // Created by snnnow on 2020/7/29. 3 // 4 5 #include<bits/stdc++.h> 6 using namespace std; 7 struct node { 8 stri 阅读全文
posted @ 2020-07-29 15:23 安之若醇 阅读(115) 评论(0) 推荐(0) 编辑
摘要: 这个题,,,由于dfs是个bool型的,,,在递归的时候,忘记写return 然后就一直错orz 1 #include <iostream> 2 #include <string> 3 #include <cstring> 4 5 using namespace std; 6 string a[11 阅读全文
posted @ 2020-07-29 10:50 安之若醇 阅读(127) 评论(0) 推荐(0) 编辑
摘要: 学一下咋优化: 其实本来看见这个题,你应该知道四个for循环可以解决 优化主要有两种方法,第一个是减小枚举的范围,第二个是减少层数 本题范围肯定是减少不了了, 看一下层数: 最后那个d,其实可以用N-a^2-b^2-c^2来算 如果能开出来就是可以 其实还是不太行emmmm 如果再优化,可以先把c^ 阅读全文
posted @ 2020-07-28 18:05 安之若醇 阅读(131) 评论(0) 推荐(0) 编辑
上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 22 下一页
Live2D服务支持