codeforces
Y12309
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Codeforces Round #754 (Div. 2) A、B、C题题解
A题目说a1+a3=2*a2,所以我们可以判断a1,a2,a3的和是否可以分成三等份,如果可以,说明答案为0,如果不可以,说明答案为1(因为我可以挑选两个数,一个慢慢加,一个慢慢减,所以无论如何我的答案都不会超过1)。#include<iostream>using namespace std;int main(){ int t; cin>>t; while(t--) { int a,b,c; cin>>a>>b>>c;原创 2021-11-16 19:49:51 · 881 阅读 · 0 评论 -
codeforces Technocup 2022 - Elimination Round 2 A、B、C题解
A简单构造即可。#include<iostream>using namespace std;typedef long long ll;int main(){ int t; cin>>t; while(t--) { ll u,v; cin>>u>>v; cout<<u*u<<" "<<-v*v<<endl; } return 0;}B因为题目要求的是要让相邻的格子颜色原创 2021-11-15 15:48:07 · 809 阅读 · 0 评论 -
Codeforces Round #753 (Div. 3) A、B、C、D题解
A题暴力代码如下:#include<iostream>#include<cstring>#include<cmath>using namespace std;int main(){ int T; cin>>T; while(T--) { char op; string a; int b[55]; int c=0; for(int i=0;i<26;i++) { cin>>op; b原创 2021-11-03 21:48:31 · 158 阅读 · 0 评论 -
Codeforces Round #748 (Div. 3) A、B题题解
A直接比较大小即可#include<iostream>#include<algorithm>using namespace std;int main(){ int T; cin>>T; while(T--) { int a,b,c,a1=0,b1=0,c1=0; cin>>a>>b>>c; int maxn; maxn=max(a,b); maxn=max(maxn,c); if(a<b原创 2021-10-15 21:33:36 · 137 阅读 · 0 评论 -
Codeforces Round #747 (Div. 2)
A构造,(-n-1)~ 0 与 0 ~ (n-1)和相抵为0A题代码#include<iostream>using namespace std;int main(){ int T; cin>>T; while(T--) { long long n; cin>>n; cout<<-(n-1)<<" "<<n<<endl; } } B二进制思想,以3举例,他的特殊数可以是1 3 4 9原创 2021-10-11 20:32:38 · 177 阅读 · 0 评论 -
Codeforces Round #744 (Div. 3) C. Ticks题解
原题链接模拟找到当前为 * 的点,判断它的两上角对角线上的点是否为 *,如果为 * 的数量大于等于d ,标记为真,最后再判断是否所有 * 都为真。代码#include<iostream>#include<cstring>using namespace std;char g[20][20];bool f[20][20];int n,m,k;void solve(int x,int y){ int d=0; for(int i=x-1,j=y-1,k=y+1;原创 2021-10-01 17:31:47 · 516 阅读 · 0 评论 -
Codeforces Round #744 (Div. 3) D. Productive Meeting 题解
原题链接用大根堆做就很简单用大根堆存每次取出最大的和第二个最大的,每次两个减一,然后入队.代码#include<iostream>#include<queue>using namespace std;const int N=2e5+10;typedef pair<int,int>PII;PII s[N];int main(){ int T; cin>>T; while(T--) { int n; cin>>n;原创 2021-10-01 16:14:26 · 195 阅读 · 0 评论 -
Codeforces Round #744 (Div. 3) B. Shifting Sort 题解
原题链接贪心这道题我们可以用一种贪心的思想,题目是要求我们将数组按照向左循环移动的方法使数组单调递增,那么我们可以先找到当前未排序的最大值,通过移动1个距离使最大值到其原本的位置,也就是移动该值至该值应该在的位置的那一段,拿{2,5,1,4,3}举例,我先找到未排序的最大值5,它原本的位置应该是在5,但它现在在2的位置,所以我只需要移动2至5,移动距离为1,我就可以将5放在正确的位置,此时数组变成了{2,1,4,3,5}然后再接着找未排序的最大值,也就是4,它在3,所以移动3至4,距离为1,数组变为{2原创 2021-09-29 20:07:00 · 292 阅读 · 0 评论
分享