Cod sursa(job #1412992)

Utilizator smatei16Matei Staicu smatei16 Data 1 aprilie 2015 18:00:19
Problema Oz Scor 5
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.39 kb
#include <cstdio>

using namespace std;
int n,m,i,a[10003],x,y,z;
int main()
{
    freopen("oz.in","r",stdin);
    freopen("oz.out","w",stdout);
    scanf("%d %d",&n,&m);
    for(i=1; i<=n; i++)a[i]=1;
    for(i=1; i<=m; i++)
    {
        scanf("%d %d %d",&x,&y,&z);
        a[x]*=z;
        a[y]*=z;
    }
    for(i=1; i<=n; i++)
        printf("%d ",a[i]);


    return 0;
}