上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 22 下一页

2021年2月16日

摘要: https://www.acwing.com/problem/content/447/ 水题。 1 #include<iostream> 2 using namespace std; 3 int main(void){ 4 int n; 5 cin>>n; 6 int res=0; 7 while( 阅读全文
posted @ 2021-02-16 19:35 greenofyu 阅读(21) 评论(0) 推荐(0)
摘要: https://www.acwing.com/problem/content/451/ 水题。 确定p有且仅有两个质因子。 故可直接枚举较小的那个质因子。 1 #include<iostream> 2 using namespace std; 3 int main(void){ 4 int p; 5 阅读全文
posted @ 2021-02-16 19:34 greenofyu 阅读(22) 评论(0) 推荐(0)
摘要: https://www.acwing.com/problem/content/443/ 水题。 1 #include<iostream> 2 using namespace std; 3 int main(void){ 4 int l,r; 5 cin>>l>>r; 6 int cnt=0; 7 f 阅读全文
posted @ 2021-02-16 19:33 greenofyu 阅读(16) 评论(0) 推荐(0)

2021年2月11日

摘要: https://www.acwing.com/problem/content/501/ 1 #include<iostream> 2 using namespace std; 3 const int N=200010; 4 typedef long long LL; 5 int v[N],w[N]; 阅读全文
posted @ 2021-02-11 16:40 greenofyu 阅读(69) 评论(0) 推荐(0)

2021年2月10日

摘要: https://www.acwing.com/activity/content/code/content/846810/ n个牛进行叠罗汉,每头牛有一个重量w和强壮程度s,风险等级定义为头上的牛的质量减去我的强壮程度,问如何叠最大的风险等级最小。 1 #include<algorithm> 2 #i 阅读全文
posted @ 2021-02-10 22:58 greenofyu 阅读(61) 评论(0) 推荐(0)
摘要: https://www.acwing.com/problem/content/460/ 发现L的范围只有100,直接枚举分子分母。 1 #include<iostream> 2 #include<cmath> 3 using namespace std; 4 int gcd(int a,int b) 阅读全文
posted @ 2021-02-10 21:45 greenofyu 阅读(46) 评论(0) 推荐(0)
摘要: https://www.acwing.com/problem/content/submission/124/ n个同学围成一个圈,每个同学手上有ai个糖果,每传递一个糖果代价为1,问最少代价为多少使得糖果均分。 将解得的x1,x2....xn带入目标式子中。 所以只需要构造一种糖果传递方案,使得每次 阅读全文
posted @ 2021-02-10 21:31 greenofyu 阅读(51) 评论(0) 推荐(0)
摘要: https://www.acwing.com/problem/content/1615/ 写出一个正确的dfs就可以了。 1 #include<iostream> 2 using namespace std; 3 char s[9][9]; 4 bool row[9][10],col[9][10], 阅读全文
posted @ 2021-02-10 16:35 greenofyu 阅读(72) 评论(0) 推荐(0)

2021年2月9日

摘要: https://www.acwing.com/problem/content/1232/ 求出一个数组中是k的倍数的连续子序列有多少个。 因为数组元素大于0,所以保证前缀和数组是一个单调上升数组。 将前缀和数组分为k类,模k为0,模k为1... 对于每一个前缀和只需要找和他同类的有多少个就可以了。 阅读全文
posted @ 2021-02-09 22:44 greenofyu 阅读(57) 评论(0) 推荐(0)
摘要: A:水题,求数组中只出现一次的元素的和。 1 class Solution { 2 public: 3 int sumOfUnique(vector<int>& nums) { 4 unordered_map<int,int> m; 5 for(auto x:nums){ 6 m[x]++; 7 } 阅读全文
posted @ 2021-02-09 21:44 greenofyu 阅读(46) 评论(0) 推荐(0)
上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 22 下一页