Codeforces Round #682 (Div. 2)

摳腳老騷發表於2020-11-16

Codeforces Round #682 (Div. 2)

A. Specific Tastes of Andre

#include <bits/stdc++.h>

#define int ll
using namespace std;
typedef long long ll;
const int maxn = 3e4 + 10;
const int mod = 998244353;

void solve() {
    int n;
    cin>>n;
    for (int i = 0; i < n; ++i) {
        cout<<"1 ";
    }
}

signed main() {
    //ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int _ = 1;
    cin >> _;
    while (_--) {
       solve();
    }
    return 0;
}

B. Valerii Against Everyone

因為ai=2^bi,所以如果有兩段相等必有倆個相等的數。

#include <bits/stdc++.h>

#define int ll
using namespace std;
typedef long long ll;
const int maxn = 3e4 + 10;
const int mod = 998244353;

map<int ,int >mp;

void solve() {
    mp.clear();
    int n;
    cin>>n;
    for (int i = 0; i < n; ++i) {
        int x;
        cin>>x;
        mp[x]++;
    }
    for(auto x:mp)
        if(x.second>1) {
            cout<<"YES\n";
            return;
        }
    cout<<"NO\n";
}

signed main() {
    //ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int _ = 1;
    cin >> _;
    while (_--) {
       solve();
    }
    return 0;
}

C. Engineer Artem

奇偶錯位,這沒想到鐵鍋鐵鍋。

#include <bits/stdc++.h>

#define int ll
using namespace std;
typedef long long ll;
const int maxn = 3e4 + 10;
const int mod = 998244353;

void solve() {
    int n,m,x;
    cin>>n>>m;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            cin>>x;
            cout<<((i+j)%2!=x%2)+x<<" ";
        }
        cout<<"\n";
    }
}

signed main() {
    //ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int _ = 1;
    cin >> _;
    while (_--) {
       solve();
    }
    return 0;
}

相關文章