1221. 值班

Andrew-Malcom

include

using namespace std;
int main()
{
        int n;cin>>n;
        int check[31]={0};
        while(n--){
                while(1==1){
                        int a;cin>>a;
                        if(a==-1) break;
                        check[a]++;
                }
        }
        for(int i=1;i<=30;i++){
                if(check[i]==0){
                        cout<<"no";return 1e9;
                }
        }
        cout<<"yes";
}
YZAZJL

include

include

include

using namespace std;

int main()
{
int n;
cin >> n;
int i;
int a[n * 30];
int j = 0;
int tmp;
for(i = 0; i < n; i++){
while(cin >> tmp){
if(tmp != -1){
a[j] = tmp;
j++;
}
if(tmp == -1){
break;
}
}
}
sort(a, a + j);
int cnt = unique(a, a + j) - a;
if(cnt == 30){
cout << “yes” << endl;
}else{
cout << “no” << endl;
}
return 0;
}

你当前正在回复 博客/题目
存在问题!