臭入机一枚,求条
查看原帖
臭入机一枚,求条
1029066
lichitao75楼主2025/1/22 11:41
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
const int maxn=1e3+5;
int n,m;
bool a[maxn][maxn];
int d[maxn];

int main(){
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	cin>>n>>m;
	for(int i=1,x,y;i<=n;i++){
		cin>>x>>y;
		a[x][y]=a[y][x]=1;
		d[x]++,d[y]++;
	}
	for(int i=1;i<=n;i++,cout<<endl){
		for(int j=1;j<=n;j++){
			cout<<a[i][j]<<" ";
		}
	}
	for(int i=1;i<=n;i++,cout<<endl){
    	

		for(int j=1;j<=n;j++){
		    a[i][j] && cout<<j<<" ";
		}
	}
	return 0;
}

编译器一直警告我

cout<<d[i]<<"\ ";

有错 来个大佬9958

2025/1/22 11:41
加载中...