CodeFoeces-864A

题目

原题链接:A. Fair Game

题意

一共有n张卡片,A和B各叫一个数字,随后会拿走卡片中所有为自己所叫数字的卡片,问这n张卡片是否公平。

代码

#include
using namespace std;
int main() {
    int n,t;
    map s;
    map::iterator it;
    scanf("%d",&n);
    for(int i=0; isecond!=n/2){
            printf("NO\n");
            return 0;
        }
    }
    if(s.size()!=2) {
        printf("NO\n");
    } else {
        printf("YES\n");
        for(it=s.begin(); it!=s.end(); it++) {
            printf("%d",it->first);
            if(it!=s.end()) {
                printf(" ");
            }
        }
        printf("\n");
    }
    return 0;
}

你可能感兴趣的:(CodeFoeces-864A)