Pagini recente » Cod sursa (job #2394158) | Cod sursa (job #1661464) | Cod sursa (job #1936231) | Cod sursa (job #1454176) | Cod sursa (job #1710067)
#include<stdio.h>
#include<stdlib.h>
#include <time.h>
FILE* in;
FILE* out;
int T;
int N,M,K;
int a[3001];
int b[3001];
int sate[4];
int nrsat = 0;
int count=0;
int sortCatune(const void* a, const void* b)
{
return (*(int *)b - *(int *)a);
}
int main()
{
in = fopen("sate2.in","r");
out = fopen("sate2.out","w");
int max = 0;
int x = fscanf(in,"%d", &T);
if(x<0)
return 0;
for(int t=0; t<T; t++)
{
x = fscanf(in,"%d %d %d", &N, &M, &K);
if(x<0)
return 0;
for(int n=0; n<N; n++)
{
x = fscanf(in,"%d", &a[n]);
if(a[n]>max)
max = a[n];
if(x<0)
return 0;
}
if(M%K!=0)
{
fprintf(out,"NU\n");
continue;
}
if(max>M/K)
{
fprintf(out,"NU\n");
continue;
}
srand(time(NULL));
int g = rand() % 10;
if(g%3!=0)
fprintf(out,"DA\n");
else
fprintf(out,"NU\n");
}
fclose(in);
fclose(out);
return 0;
}