Pagini recente » Cod sursa (job #381019) | Cod sursa (job #1606866) | Cod sursa (job #2864938) | Cod sursa (job #1574442) | Cod sursa (job #2037214)
#include <iostream>
#include <fstream>
using namespace std;
ifstream in("oz.in");
ofstream out("oz.out");
const int maxn = 10005;
int v[maxn];
int main()
{
int n, m;
in >> n >> m;
for(int i = 1; i <= n; i++)
v[i] = 1;
for(int i = 1; i <= m; i++)
{
int x, y, p;
in >> x >> y >> p;
v[x] = v[x] * p;
v[y] = v[y] * p;
}
for(int i = 1; i <= n; i++)
out << v[i] << " ";
out << "\n";
return 0;
}