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

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 阅读(32) 评论(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 阅读(39) 评论(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 阅读(108) 评论(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 阅读(66) 评论(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 阅读(55) 评论(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 阅读(86) 评论(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 阅读(51) 评论(0) 推荐(0)

2021年3月26日

摘要: https://www.acwing.com/problem/content/293/ 给定一个空矩阵,问用1*2的矩形将其填满存在多少种方案。 可以只考虑一种,如果横的都已经确定了,那么竖的只有0或者1种放法,所以只考虑横的就好了(只考虑竖的也行) 暴搜复杂度为O(N! * M!),所以只能考虑动 阅读全文
posted @ 2021-03-26 09:47 greenofyu 阅读(79) 评论(0) 推荐(0)
摘要: https://www.acwing.com/problem/content/3260/ 水题。 每次记录上一次连续多少次跳到了中心即可。 1 #include<iostream> 2 using namespace std; 3 int main(void){ 4 int res=0,point= 阅读全文
posted @ 2021-03-26 09:45 greenofyu 阅读(45) 评论(0) 推荐(0)
摘要: https://www.acwing.com/problem/content/3230/ 利用标记变量。 1 #include<iostream> 2 using namespace std; 3 const int N=1010; 4 int a[N]; 5 int main(void){ 6 i 阅读全文
posted @ 2021-03-26 09:44 greenofyu 阅读(36) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 8 9 10 ··· 22 下一页