上一页 1 2 3 4 5 6 7 8 9 10 ··· 22 下一页

2021年5月24日

摘要: A:水题,给定01串,问连续的0更长还是连续的1更长。 直接遍历即可。 1 class Solution { 2 public: 3 bool checkZeroOnes(string s) { 4 int res1=0,res0=0; 5 int cnt1=0,cnt0=0; 6 for(int 阅读全文
posted @ 2021-05-24 21:39 greenofyu 阅读(50) 评论(0) 推荐(0)

2021年5月23日

摘要: A:水题,找到不小于n的能够被4整除的最小的数。 假设n不能被4整除,那么n+1,n+2,n+3之中一定存在一个数能够被4整除。所以直接枚举即可。 1 #include <iostream> 2 #include <cstring> 3 #include <algorithm> 4 using na 阅读全文
posted @ 2021-05-23 15:36 greenofyu 阅读(57) 评论(0) 推荐(0)

2021年5月20日

摘要: https://www.acwing.com/problem/content/3513/ 其中一个串不重复是公共子序列问题转换为上升子序列问题的一个充要条件。 #include <iostream> #include <cstring> #include <algorithm> using name 阅读全文
posted @ 2021-05-20 20:42 greenofyu 阅读(58) 评论(0) 推荐(0)

2021年5月17日

摘要: https://www.acwing.com/problem/content/3502/ 1 #include <iostream> 2 #include <cstring> 3 #include <algorithm> 4 using namespace std; 5 int n,k,m; 6 c 阅读全文
posted @ 2021-05-17 22:08 greenofyu 阅读(38) 评论(0) 推荐(0)

2021年5月16日

摘要: A:水题,直接暴搜就好了。 1 class Solution { 2 public: 3 int res; 4 void dfs(vector<int>&nums,int i,int sum){ 5 if(i==nums.size()){ 6 res+=sum; 7 return ; 8 } 9 d 阅读全文
posted @ 2021-05-16 23:02 greenofyu 阅读(41) 评论(0) 推荐(0)

2021年5月6日

摘要: A:计算256MB能够存放多少个int 1 int main() 2 { 3 cout<<256*1024*1024/4; 4 return 0; 5 } ans=67108864 B:计算2021张1到10的卡片能够拼出1~n的最大的n 1 int cnt[10]; 2 int main() 3 阅读全文
posted @ 2021-05-06 20:32 greenofyu 阅读(114) 评论(0) 推荐(0)

2021年5月3日

摘要: A:水题,直接枚举即可。 1 class Solution { 2 public: 3 int getMinDistance(vector<int>& nums, int target, int start) { 4 int res=0,seq=INT_MAX; 5 for(int i=0;i<nu 阅读全文
posted @ 2021-05-03 18:00 greenofyu 阅读(78) 评论(0) 推荐(0)

2021年4月25日

摘要: A:水题 1 class Solution { 2 public: 3 int sumBase(int n, int k) { 4 int res=0; 5 while(n){ 6 res+=n%k; 7 n/=k; 8 } 9 return res; 10 } 11 }; B:给定一个数组和一个可 阅读全文
posted @ 2021-04-25 16:18 greenofyu 阅读(66) 评论(0) 推荐(0)

2021年4月11日

摘要: https://www.acwing.com/problem/content/3305/ 1 #include<iostream> 2 #include<cstring> 3 #include<string> 4 #include<unordered_map> 5 #include<stack> 6 阅读全文
posted @ 2021-04-11 16:22 greenofyu 阅读(94) 评论(0) 推荐(0)
摘要: 又是该LL用int了,什么时候才能不犯病啊。 A:水题,让你找出3个以上的数组中不同的那个数 我是直接分情况。 1 #include<iostream> 2 #include<vector> 3 using namespace std; 4 const int N=110; 5 int a[N]; 阅读全文
posted @ 2021-04-11 08:02 greenofyu 阅读(57) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 8 9 10 ··· 22 下一页