Codeforces Round #726 (Div. 2) ABCDEEF题解

Posted quinn18

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Codeforces Round #726 (Div. 2) ABCDEEF题解相关的知识,希望对你有一定的参考价值。


A - Arithmetic Array

#include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;
typedef long long ll;
const int M = 1e9+7;
int a[105];
int main() {
    int t;
    cin>>t;
    while(t--) {
        int n;
        cin>>n;
        int sum=0;
        for(int i=1; i<=n; i++) {
            cin>>a[i];
            sum+=a[i];
        }
        if(sum==n) cout<<0<<endl;
        else if(sum<n) cout<<1<<endl;
        else cout<<sum-n<<endl;
    }
    return 0;
}

B - Bad Boy

#include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;
typedef long long ll;
const int M = 1e9+7;
struct node{
    int x, y;
}a[5];
int main() {
    int t;cin>>t;
    while(t--) {
        int n, m, xx, yy;
        cin>>n>>m>>xx>>yy;
        cout<<1<<" "<<1<<" "<<n<<" "<<m<<endl;//怪离谱的 还想了四个点
    }
    return 0;
}

C - Challenging Cliffs

两个升序

#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
typedef long long ll;
const int M = 1e9+7;
ll a[200005], b[200005];
int main() {
    int t;
    cin>>t;
    while(t--) {
        int n;
        cin>>n;
        for(int i=1; i<=n; i++) {
            cin>>a[i];
        }
        sort(a+1, a+1+n);
        int ans=0;
        ll minn=1e18;
        for(int i=2; i<=n; i++) {
            if(minn>a[i]-a[i-1]) {
                ans=i;
                minn=a[i]-a[i-1];
            }
        }
        b[1]=a[ans-1];b[n]=a[ans];
        int q=2;
        for(int i=ans+1; i<=n; i++) {
            b[q++]=a[i];
        }
        for(int i=1; i<=ans-2; i++) {
            b[q++]=a[i];
        }
        for(int i=1; i<=n; i++) {
            cout<<b[i]<<" \\n"[i==n];
        }
    }
    return 0;
}

D - Deleting Divisors

找规律

#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
typedef long long ll;
const int M = 1e9+7;
ll a[200005], b[200005];
int main() {
    int t;
    cin>>t;
    while(t--) {
        int n;
        cin>>n;
        if(n%2==1||n==1) cout<<"Bob"<<endl;
        else {
            ll x=n;
            int cnt=0;
            while(x%2==0) {
                x/=2;
                cnt++;
            }
            if(x==1) {
                if(cnt%2==0) cout<<"Alice"<<endl;
                else cout<<"Bob"<<endl;
            }else cout<<"Alice"<<endl;
        }
    }
    return 0;
}

E1 - Erase and Extend (Easy Version)

看前缀

E2 - Erase and Extend (Easy Version)

nonono

F - Figure Fixing

![jj](https://img-blog.csdnimg.cn/2021061901094623.jpg#pic_center)

总结

以上是关于Codeforces Round #726 (Div. 2) ABCDEEF题解的主要内容,如果未能解决你的问题,请参考以下文章

Codeforces Round #726 (Div. 2) 6-18

Codeforces Round #726 (Div. 2) D题解

Codeforces Round #726 (Div. 2)(补题)

Codeforces Round #726 (Div. 2) A. Arithmetic Array

Codeforces Round #726 div.2 A-F题解

Codeforces Round #726 div.2 A-F题解