Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- int ne;
- cin>>ne;
- int adj[ne+1][ne+1];
- for(int r=0;r<=8;r++)
- {
- for(int c=0;c<=8;c++)
- {
- adj[r][c] = INT_MAX;
- }
- }
- for(int i=1; i<=ne; i++)
- {
- int u,v,w;
- cin>>u>>v>>w;
- adj[u][v]=w;
- adj[v][u]=w;
- }
- for(int r=0;r<=8;r++)
- {
- for(int c=0;c<=8;c++)
- {
- if(adj[r][c]==INT_MAX)
- cout<<"NULL " ;
- else
- cout<<adj[r][c] <<" ";
- }
- cout<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement