[Codeforces Round495B] Sonya and Exhibition

[题目链接]

        https://codeforces.com/contest/1004/problem/B

[算法]

        不难发现 , 最优解一定是01010101....

        时间复杂度 : O(N)

[代码]

        

#include<bits/stdc++.h>
using namespace std;

template <typename T> inline void read(T &x)
{
    T f = 1; x = 0;
    char c = getchar();
    for (; !isdigit(c); c = getchar()) if (c == '-') f = -f; 
    for (; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + c - '0';
    x *= f;
}

int main() 
{
    
        int n,m;
        read(n); read(m);
        for (int i = 1; i <= m; i++)
        {
                int a,b;
                read(a); read(b);
        }
        for (int i = 1; i <= n; i++) printf("%d",(i % 2) ? 0 : 1);
        printf("\n");
        
        return 0;
    
}

猜你喜欢

转载自www.cnblogs.com/evenbao/p/9610782.html