
暴力枚举
幽殇默
他时若遂凌云志,敢笑黄巢不丈夫。
展开
-
869. 重新排序得到 2 的幂【枚举】
https://leetcode-cn.com/problems/reordered-power-of-2/ class Solution { public: vector<int> check(int x) { vector<int>ve; while(x) ve.push_back(x%10),x/=10; sort(ve.begin(),ve.end()); return ve; } .原创 2021-10-28 08:47:19 · 83 阅读 · 0 评论 -
B. BerSU Ball【1200 / 暴力】
https://codeforces.com/problemset/problem/489/B #include<bits/stdc++.h> using namespace std; int n,m,a[105],b[105]; map<int,int>mp; int main(void) { cin>>n; for(int i=0;i<n;i++) cin>>a[i]; cin>>m; int cnt=0; for(int i.原创 2021-10-23 22:23:56 · 115 阅读 · 0 评论 -
A. Cheap Travel【1200 / 暴力】
https://codeforces.com/problemset/problem/466/A #include<bits/stdc++.h> using namespace std; typedef long long int LL; int main(void) { LL n,m,a,b; cin>>n>>m>>a>>b; LL ans=1e9; for(int i=0;i<=n;i++) { for(int j=0;j&.原创 2021-10-23 17:47:14 · 135 阅读 · 0 评论 -
A. IQ test【1300 / 暴力】
https://codeforces.com/problemset/problem/25/A #include<bits/stdc++.h> using namespace std; int a[105],n; int main(void) { int cnt1=0,cnt2=0; cin>>n; for(int i=1;i<=n;i++) { cin>>a[i]; if(a[i]&1) cnt1++; else cnt2++; }.原创 2021-10-23 09:47:43 · 112 阅读 · 0 评论 -
A. Supercentral Point【1000 / 暴力】
https://codeforces.com/problemset/problem/165/A 存一下同x的所有y 存一下同y的所有x 对于每一个点暴力查找即可。 #include<bits/stdc++.h> using namespace std; int n; vector<pair<int,int>>ve; map<int,vector<int> >a,b; int main(void) { cin>>n; for(i.原创 2021-10-19 09:02:30 · 92 阅读 · 0 评论 -
B. Groups【1000 / 暴力枚举】
https://codeforces.com/contest/1598/problem/B 暴力枚举所有的俩组的情况,对于每种情况判断可不可以达到要求。 #include<bits/stdc++.h> using namespace std; const int N=1e5+10; int a[N][6]; int main(void) { int t; cin>>t; while(t--) { int n; cin>>n; for(int i=1;i&l.原创 2021-10-10 22:45:09 · 280 阅读 · 0 评论 -
1084: 三位数 【超时 / 待优化】
http://oj.ecustacm.cn/problem.php?id=1084 超时了,刚开始没看清题目,以为分为三个数字。后来才看到分成三个三位数字 #include<cstdio> #include<iostream> #include<algorithm> #include<string> using namespace std; string a="123456789"; int main(void) { int i,j; int ans=0.原创 2021-04-07 11:26:52 · 189 阅读 · 0 评论