Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as C++ by aaa111 ( 15 years ago )
#include <stdio.h>
typedef long long ll;
ll profit(ll d, ll e,ll f)
 {if (d<e) return f*d; else return f*e;}

int main()
{
 struct a {int v,w,p;};
 int m,n,i,j; a mas[100][100]; int occ[100]; ll x,max;
//FILE* g=fopen&#40;"111.our","w"&#41;;
FILE* f=fopen&#40;"btdonalds.in","r"&#41;;
fscanf (f,"%d",&m);fscanf(f,"%d",&n); 

for (i=0; i<m; i++)
   for (j=0; j<n; j++) fscanf(f,"%d",&mas;[i][j].v);
for (i=0; i<m; i++)
   for (j=0; j<n; j++) fscanf(f,"%d",&mas;[i][j].w);
for (i=0; i<m; i++)
   for (j=0; j<n; j++) fscanf(f,"%d",&mas;[i][j].p);

x=0;
for (i=0; i<m; i++)
  {max=0;
   for (j=0; j<n; j++)
   {//printf("%d %d %I64dn",i,j,profit ( mas[i][j].v ,mas[i][j].w,mas[i][j].p));
    if (max<profit (mas[i][j].v,mas[i][j].w,mas[i][j].p)) {max=profit (mas[i][j].v,mas[i][j].w,mas[i][j].p);};}
   x=x+max; 
  }
//rintf("%I64dn",profit(mas[0][0].v,mas[0][0].w,mas[0][0].p));
//printf("%dn%dn%dn",mas[0][0].v,mas[0][0].w,mas[0][0].p);
printf("%I64d",x);
}

 

Revise this Paste

Your Name: Code Language: