EOJ1221

值班

Time Limit:1000MS Memory Limit:30000KB
Total Submit:985 Accepted:568

Description 

马上就到6月份了,又要安排实验室值班人员了。PPP现在只有一份表格,上面记录着每个人每天是否可以值班。

Input 

第一行为一个整数N,表示有N个人愿意参加值班。
接下来N行:
D11 D12 D13 ... -1
D21 D22 D23 ... -1
.......
.......
DN1 DN2 DN3 ... -1
Di表示第i个人在6月份的可以值班的时间, 每行均以-1结束

Output 

输出yes如果6月份每天都有人值班, 否则输出no

Sample Input 

2
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 -1
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 -1

Sample Output 

yes


#include <stdio.h>

int main(){
    int june[31] = {0};
    int n = 0, day = 0, totalDay = 0;
    scanf("%d", &n);
    while(n--){
        while(scanf("%d", &day) && day != -1)
            if(june[day] == 0){
                june[day] = 1;
                totalDay++;
            }
    }

    if(totalDay == 30)
        printf("yes\n");
    else
        printf("no\n");

    return 0;
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值