Codeforces Round #268 (Div. 2) 就差一点就能上蓝了......

来源:互联网 发布:怎样下载金蝶软件 编辑:程序博客网 时间:2024/04/30 06:45

Codeforces Round #268 (Div. 2)

首先声明本学渣是绿名........大犇切勿鄙视.........

A. I Wanna Be the Guy

time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

There is a game called "I Wanna Be the Guy", consisting of n levels. Little X and his friend Little Y are addicted to the game. Each of them wants to pass the whole game.

Little X can pass only p levels of the game. And Little Y can pass onlyq levels of the game. You are given the indices of levels Little X can pass and the indices of levels Little Y can pass. Will Little X and Little Y pass the whole game, if they cooperate each other?

Input

The first line contains a single integer n (1 ≤  n ≤ 100).

The next line contains an integer p (0 ≤ p ≤ n) at first, then follows p distinct integers a1, a2, ..., ap(1 ≤ ai ≤ n). These integers denote the indices of levels Little X can pass. The next line contains the levels Little Y can pass in the same format. It's assumed that levels are numbered from 1 ton.

Output

If they can pass all the levels, print "I become the guy.". If it's impossible, print "Oh, my keyboard!" (without the quotes).

Sample test(s)
Input
43 1 2 32 2 4
Output
I become the guy.
Input
43 1 2 32 2 3
Output
Oh, my keyboard!
Note

In the first sample, Little X can pass levels [1 2 3], and Little Y can pass level [2 4], so they can pass all the levels both.

In the second sample, no one can pass level 4.

一:第一题直接开数组存时间,然后判断区间是否填满就行了..........

#include<iostream>#include<cstring>using namespace std;const int M=105;int n;int p;int q;int s[M];int main(){    memset(s, 0, sizeof(s));    cin>>n;    cin>>p;    for (int i=1; i<=p; i++)    {        int k;        cin>>k;        s[k]=1;    }    cin>>q;    for (int i=1; i<=q; i++)    {        int k;        cin>>k;        s[k]=1;    }    bool flag=false;    for (int i=1; i<=n; i++)    {        if (!s[i])        {            flag=true;            break;        }    }    if (!flag) cout<<"I become the guy."<<endl;    else cout<<"Oh, my keyboard!"<<endl;    return 0;}

--------------------------------------------------------------------------华丽的分割线-------------------------------------------------------------------------------------------------


B. Chat Online

time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Little X and Little Z are good friends. They always chat online. But both of them have schedules.

Little Z has fixed schedule. He always online at any moment of time between a1 and b1, betweena2 andb2, ..., betweenap andbp (all borders inclusive). But the schedule of Little X is quite strange, it depends on the time when he gets up. If he gets up at time0, he will be online at any moment of time between c1 andd1, betweenc2 andd2, ..., betweencq anddq (all borders inclusive). But if he gets up at timet, these segments will be shifted byt. They become [ci + t, di + t] (for alli).

If at a moment of time, both Little X and Little Z are online simultaneosly, they can chat online happily. You know that Little X can get up at an integer moment of time betweenl andr (both borders inclusive). Also you know that Little X wants to get up at the moment of time, that is suitable for chatting with Little Z (they must have at least one common moment of time in schedules). How many integer moments of time from the segment [l, r] suit for that?

Input

The first line contains four space-separated integers p, q, l, r (1 ≤  p, q ≤ 50; 0 ≤ l ≤ r ≤ 1000).

Each of the next p lines contains two space-separated integersai, bi (0 ≤ ai < bi ≤ 1000). Each of the next q lines contains two space-separated integerscj, dj (0 ≤ cj < dj ≤ 1000).

It's guaranteed that bi < ai + 1 anddj < cj + 1 for all validi and j.

Output

Output a single integer — the number of moments of time from the segment [l, r] which suit for online conversation.

Sample test(s)
Input
1 1 0 42 30 1
Output
3
Input
2 3 0 2015 1723 261 47 1115 17
Output
20

二:第二题也是简单的数组存放相同的上网时间点.......数据太弱了....直接暴力存储....我是学渣....

#include<iostream>#include<cstring>using namespace std;const int M=5005;int m[M];int x[M];int y[M];int s[M];int p, q, l, r;int main(){    memset(m, 0, sizeof(m));    memset(s, 0, sizeof(s));    cin>>p>>q>>l>>r;    for (int i=1; i<=p; i++)    {        int a, b;        cin>>a>>b;         for (int j=a; j<=b; j++)         s[j]=1;    }    for (int i=1; i<=q; i++)    {        int a, b;        cin>>a>>b;        x[i]=a;        y[i]=b;    }    int ans=0;    bool flag;    for (int i=l; i<=r; i++)    {        for (int k=1; k<=q; k++)        {           flag=false;           for (int j=x[k]; j<=y[k]; j++)           {            if (s[j+i]) {            ans++;            flag=true;            break;            }           }           if (flag) break;        }    }    cout<<ans<<endl;    return 0;}

--------------------------------------------------------------------------华丽的分割线-------------------------------------------------------------------------------------------------


C. 24 Game

time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Little X used to play a card game called "24 Game", but recently he has found it too easy. So he invented a new game.

Initially you have a sequence of n integers:1, 2, ..., n. In a single step, you can pick two of them, let's denote thema andb, erase them from the sequence, and append to the sequence eithera + b, ora - b, or a × b.

After n - 1 steps there is only one number left. Can you make this number equal to24?

Input

The first line contains a single integer n(1 ≤ n ≤ 105).

Output

If it's possible, print "YES" in the first line. Otherwise, print "NO" (without the quotes).

If there is a way to obtain 24 as the result number, in the followingn - 1 lines print the required operations an operation per line. Each operation should be in form: "aopb =c". Wherea andb are the numbers you've picked at this operation;op is either "+", or "-", or "*";c is the result of corresponding operation. Note, that the absolute value ofc mustn't be greater than1018. The result of the last operation must be equal to24. Separate operator sign and equality sign from numbers with spaces.

If there are multiple valid answers, you may print any of them.

Sample test(s)
Input
1
Output
NO
Input
8
Output
YES8 * 7 = 566 * 5 = 303 - 4 = -11 - 2 = -130 - -1 = 3156 - 31 = 2525 + -1 = 24

第三题差30秒我就能ac了..................就是只差30秒啊................结束后我交了就ac了.........我不服....好吧...渣渣没吐槽的权利。

三:其实这一题看起来很难,实际上脑补一下有什么可以水过就行了,我先打表了前8, 前8已经可以组成0, 和 24, 0乘以任何数等于0, 所以只需要将后面的乘上就行了,

然后最后0+24=24........


#include<iostream>using namespace std;int n;int main(){    cin>>n;    if (n<=3){        cout<<"NO"<<endl;        return 0;    }    cout<<"YES"<<endl;    if (n==4) cout<<"3 * 4 = 12\n2 * 1 = 2\n12 * 2 = 24\n";    else if (n==5) cout<<"4 * 5 = 20\n2 + 3 = 5\n5 - 1 = 4\n20 + 4 = 24\n" ;    else if (n==6) cout<<"4 * 5 = 20\n2 - 1 = 1\n6 - 3 = 3\n20 + 1 = 21\n21 + 3 = 24\n";    else if (n==7) cout<<"6 * 7 = 42\n4 * 5 = 20\n42 - 20 = 22\n3 - 2 = 1\n22 + 1 = 23\n23 + 1 = 24\n";    else if (n==8) cout<<"8 * 7 = 56\n6 * 5 = 30\n3 - 4 = -1\n1 - 2 = -1\n30 - -1 = 31\n56 - 31 = 25\n25 + -1 = 24\n";    else     {                cout<<"6 + 8 = 14\n";        cout<<"2 * 7 = 14\n";        cout<<"14 - 14 = 0\n";        cout<<"4 * 5 = 20\n";        cout<<"1 + 3 = 4\n";        cout<<"20 + 4 = 24\n";        for (int i=9; i<=n; i++)        {            cout<<i<<" * 0 = 0\n";        }        cout<<"24 + 0 = 24\n";    }    return 0;}

下面的大犇题,弱渣不会做,就这么多了

                                               --------------By 绿名的弱渣..........

0 0