crsandu icon

Adiacenta - 80p

crsandu | PRO | 04/01/16 04:01:19 PM UTC | 0 ⭐ | 243 👁️ | Never ⏰ | []
text |

510 B

|

None

|

0 👍

/

0 👎

#include <iostream>
#include <fstream>
 using namespace std;
 ifstream fin("adiacenta.in");
ofstream fout("adiacenta.out");
 int ma[100][100] = {0}, x, y, n, m;
 int main()
{
    fin >> n >> m;
    for (int p=1; p<=m; p++)
    {
        fin >> x >> y;
        ma[x][y] = ma[y][x] = 1;
    }
    for (int i=1; i<=n; i++)
    {
        for (int j=1; j<=n; j++)
        {
            fout << ma[i][j] << " ";
        }
        fout << endl;
    }
    fin.close();
    fout.close();
    return 0;
}

Comments