Pagini recente » Cod sursa (job #2215629) | Cod sursa (job #1062565) | Cod sursa (job #3191763) | Cod sursa (job #2775357) | Cod sursa (job #18157)
Cod sursa(job #18157)
#include <fstream.h>
int n,u,t,ok1,gas,ok2;
ifstream f("amlei.in");
ofstream g("amlei.out");
int exec()
{int i,j,x;
ok1=0;
for(i=1;i<=u;i++)
{gas=1;
for(j=1;j<=n;j++)
{f>>x;
if(x<0){j++;
while(j<=n) {f>>x;j++;}
gas=0;
}
}
if(gas){i++;
while(i<=u)
{j=1;
while(j<=n){f>>x;
j++;
}
i++;
}
ok1=1;
}
}
ok2=0;
for(i=1;i<=t;i++)
{gas=1;
for(j=1;j<=n;j++)
{f>>x;
if(x<0){j++;
while(j<=n) {f>>x;j++;}
gas=0;
}
}
if(gas){i++;
while(i<=t){j=1;
while(j<=n){f>>x;
j++;
}
i++;
}
ok2=1;
}
}
return (ok1==ok2);
}
int main()
{while(f>>n>>u>>t)
if(exec())g<<"DA"<<'\n';
else g<<"NU"<<'\n';
f.close();
g.close();
return 0;
}