给大家分享一句我很喜欢我话:
知不足而奋进,望远山而前行!!!
铁铁们,成功的路上必然是孤独且艰难的,但是我们不可以放弃,远山就在前方,但我们能力仍然不足,所有我们更要奋进前行!!!
今天我们更新了帅到没朋友内容,
🎉 欢迎大家关注🔍点赞👍收藏⭐️留言📝
题目介绍
C语言版本
#include <stdio.h>
#include <stdbool.h>
#define MAX_N 10000
int main() {
int n = 0;
scanf("%d", &n);
int no_handsome[MAX_N];
int no_handsome_size = 0;
for (int i = 0; i < n; i++) {
int k = 0;
scanf("%d", &k);
for (int j = 0; j < k; j++) {
int temp = 0;
scanf("%d", &temp);
if (k > 1) {
no_handsome[no_handsome_size++] = temp;
}
}
}
int m = 0;
scanf("%d", &m);
int handsome[MAX_N];
int handsome_size = 0;
bool flag = true;
for (int i = 0; i < m; i++) {
int temp;
scanf("%d", &temp);
if (no_handsome_size > 0) {
bool found = false;
for (int j = 0; j < no_handsome_size; j++) {
if (temp == no_handsome[j]) {
found = true;
break;
}
}
if (!found) {
bool new_handsome = true;
for (int j = 0; j < handsome_size; j++) {
if (temp == handsome[j]) {
new_handsome = false;
break;
}
}
if (new_handsome) {
if (!flag) {
printf(" ");
}
printf("%05d", temp);
flag = false;
handsome[handsome_size++] = temp;
}
}
}
}
if (handsome_size == 0) {
printf("No one is handsome");
}
return 0;
}
C++版本
#include<iostream>
#include<set>
using namespace std;
int main()
{
int n=0;
cin>>n;
set<int> no_handsome;
for(int i=0;i<n;i++)
{
int k=0;
cin>>k;
for(int j=0;j<k;j++)
{
int temp=0;
cin>>temp;
if(k>1)
{
no_handsome.insert(temp);
}
}
}
int m=0;
cin>>m;
set<int> handsome;
bool flag=true;
for(int i=0;i<m;i++)
{
int temp;
cin>>temp;
if(no_handsome.find(temp)==no_handsome.end())
{
if(handsome.find(temp)==handsome.end())
{
if(!flag)
{
cout<<" ";
}
printf("%05d",temp);
flag=false;
}
handsome.insert(temp);
}
}
if(handsome.size()==0)
{
cout<<"No one is handsome";
}
}