Madokaaa @ 2024-11-05 22:04:56
by xyx404 @ 2024-12-26 16:42:03
@Madokaaa
我也是测试点报 Wrong Answer.wrong output format Unexpected end of file - int32 expected
,但之后改对了。
我的代码:
```cpp
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define itn int
#define ull unsigned long long
int n;
int in[120];
queue<int>dl;
vector<vector<int> >tu(120);
int main(){
cin>>n;
for(int i=1;i<=n;i++){
int x;
while(cin>>x&&x!=0)tu[i].push_back(x),in[x]++;
}
for(int i=1;i<=n;i++)if(in[i]==0){
cout<<i;
dl.push(i);break;
}
while(dl.empty()==0){
int tamp=dl.front();dl.pop();
for(int i=0;i<tu[tamp].size();i++){
in[tu[tamp][i]]--;
if(in[tu[tamp][i]]==0){
cout<<" "<<tu[tamp][i];
dl.push(tu[tamp][i]);
}
}
}
return 0;
}
```
$100$ 分代码:
```cpp
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define itn int
#define ull unsigned long long
int n;
int in[120];
queue<int>dl;
vector<vector<int> >tu(120);
int main(){
cin>>n;
for(int i=1;i<=n;i++){
int x;
while(cin>>x&&x!=0)tu[i].push_back(x),in[x]++;
}
for(int i=1;i<=n;i++)if(in[i]==0){
cout<<i<<" ";
dl.push(i);// 这里的 break 没了
}
while(dl.empty()==0){
int tamp=dl.front();dl.pop();
for(int i=0;i<tu[tamp].size();i++){
in[tu[tamp][i]]--;
if(in[tu[tamp][i]]==0){
cout<<tu[tamp][i]<<" ";
dl.push(tu[tamp][i]);
}
}
}
return 0;
}
```