http://www.codechef.com/viewsolution/3118317 What’s wrong in my code? It shows WA. I’ve implemented the method shown in the editorial. Please help.
Hi,
My code runs fine on:
1
1
1
and also on the test input given.
It is showing WA.
Can you please help me with my code:
http://www.codechef.com/viewsolution/3959843
Thanks in advance.
i am getting a WA…
please help…
#include<stdio.h>
long int a[100000]={0};
int main(void)
{
long int t,n,i,min,flag,j,res;
min=100000;
scanf("%ld",&t);
while(t--)
{
scanf("%ld",&n);
for(i=0;i<n;i++)
{
scanf("%ld",&a[i]);
if(a[i]<min)
{
min=a[i];
}
}
for(i=2;i<=min;i++)
{
flag=1;
for(j=0;j<n;j++)
{
if(a[j]%i!=0)
{
flag=0;
break;
}
}
if(flag==1)
{
res=i;
break;
}
}
if(flag==0)
{
res=-1;
}
printf("%ld\n",res);
}
return 0;
}
i am getting a WA… please help…
#include<stdio.h>
int main(void)
{
int t,ds,dt,d,x;
x=0;
scanf("%d",&t);
while(t--)
{
scanf("%d%d%d",&ds,&dt,&d);
if(ds+dt<d)
{
printf("%.6f\n",(float)(d-dt-ds));
}
else
{
printf("%.6f\n",(float)(x));
}
}
return 0;
}
https://www.codechef.com/viewsolution/13098242
can somebody tell me, for which case it is not working???
I am getting WA.Please tell me the case where my code fails.
https://www.codechef.com/viewsolution/14322036
I am getting wrong answer although in the dry run everything seems to be working fine. Also, the sample test cases from editorial are working.
Can anyone suggest the test case which could fail my solution/ review my solution?
https://www.codechef.com/viewsolution/14364283
TestCases:
1 1 1 => -1 (since x>1)
1 2 20122 30183 => 10061
1 1 24371 => 24371
1 2 123 456 => 3
Many Thanks!