Cod sursa(job #243488)

Utilizator ooctavTuchila Octavian ooctav Data 13 ianuarie 2009 10:47:19
Problema Oz Scor 5
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.45 kb
// oz.cpp : Defines the entry point for the console application.
//

#include <stdio.h>
int e[10004];

int main()
{
	int a,b,c,i,j,m,n;
	FILE *f1,*f2;
	f1=fopen("oz.in","r");
	f2=fopen("oz.out","w");
	fscanf(f1,"%d %d",&n,&m);
	for(i=1;i<=n;i++)
		e[i]=1;
	for(i=1;i<=m;i++)
	{
		fscanf(f1,"%d %d %d",&a,&b,&c);
		e[a]=e[a]*c;
		e[b]=e[b]*c;
	}
	for(i=1;i<=n;i++)
		fprintf(f2,"%d ",e[i]);
	fclose(f1);
	fclose(f2);
	return 0;
}