×

# How does Codechef test whether my solution is correct or not?

 2 1 When I submit my code for a particular problem on CodeChef, who will test if my solution is correct or not? Can some one tell me how is my solution tested? asked 21 Jun '12, 11:08 454●7●10●13 accept rate: 22%

# include <stdio.h>

int main() { int t,i,n,p,r,c; scanf("%d\n",&t); for(i=0;i<t;i++) { scanf("%d\n",&n); p=0; c=0; while(n!=0) { r=n%10; c++; if(r==0) p++; n=n/10; } if((p==1) || (p==c-1)) printf("yes\n"); else printf("no\n"); } return 0; }

1
accept rate: 0%

 0 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.lang.reflect.Array; import java.util.Arrays; class UncleJohny { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int N; int t = br.read(); br.readLine(); for (int i = 0; i < t; i++) { N = Integer.parseInt(br.readLine()); String s1 = br.readLine(); String s[] = s1.split(" "); int a[] = new int[N]; for (int j = 0; j < N; j++) { a[j] = Integer.parseInt(s[j]); } int K = Integer.parseInt(br.readLine()); int c = a[K - 1]; Arrays.sort(a); for (int m = 0; m < N; m++) { if (a[m] == c) { System.out.println(m + 1); break; } } } }  } answered 11 Dec '16, 12:55 1 accept rate: 0%

# include<stdio.h>

int main() { int c,d,l,i=0,j=0,k,f=0,t,p; int x[100000]; scanf("%d",&t); for(p=0;p<t;p++) {="" i="0,f=0,j=0;" scanf("%d%d%d",&c,&d,&l);="" if(c<="d)" k="c+1;" if(c="">d) k=2d; while(i<k) { if((4c+4*d)-j==l) { f=1; break; } i++; j=j+4; } if(f==1) x[p]=f; else x[p]=f; } for(p=0;p<t;p++) { if(x[p]==1) puts("yes"); else puts("no"); } return 0; }

2
accept rate: 0%

# include<malloc.h>

int gcd(int ,int ); int main(void) { int i=0,t,j=0,n,sum=0,flag=1,z=0; int a,result;

do{
scanf("%d",&t);
if(t>=1 && t<=200000)
{
flag=0;
}
}while(flag);
z=t;

while(t--)
{
flag=1;
do{
scanf("%d",&n);

if(n>=1 && n<=1000000)
{
flag=0;
}
}while(flag);
sum=0;
a=(int *)malloc(n*sizeof(n));
result=(int *)malloc(t*sizeof(int));
for(i=1;i<=n;i++)
{
for(j=i+1;j<=n;j++)
{
sum=sum+gcd(a[i],a[j]);
}
}

result[t]=sum;
}

for(i=z;i>=1;i--)
{   printf("%d",result[i]); }
return 0;


} int gcd(int a,int b) { int r; do{ r=a%b; a=b; b=r; }while(r!=0); return a; }

1
accept rate: 0%

# include <bits stdc++.h="">

using namespace std; void te() { int n; cin >> n; vector<string> s(n); for(int i = 0; i < n; ++i) cin >> s[i]; for(int i = 0; i < n; ++i) if(s[i] == "cookie") if(i == n - 1 || s[i+1] == "cookie") { puts("NO"); return; } puts("YES"); } int main() { int T; cin >> T; while(T--) te(); }

0★nbatra
1
accept rate: 0%

# include<math.h>

int main() { unsigned long int n,count,s,a=0,k; scanf("%lu %lu",&n,&k); if(n<=pow(10,7)&&k<=pow(10,7)) { while(a<n) { scanf("%ld",&s); if(s<=pow(10,9)&&s%k==0) { count++; } a++;

}
}
printf("%lu",count);
return 0;


}

1
accept rate: 0%

 0 How do i get input and write output in PHP? I run code in IDE, it take 0,01s. But when i submit the code, i get "Time limit exceeded". answered 21 May '17, 16:14 1 accept rate: 0%
 0 Your code is correct or not is determined by test case writtern by problem setter or experienced competitive coder and reviewed by various other coder. When you submit your solution it feed specific input sets and test your output against its correct output files. Its all done in milliseconds by machine :); answered 21 May '17, 16:29 1 accept rate: 0%
 0 import java.util.Scanner; class SF{ public static void main (String[] arts){ Scanner s=new Scanner(System.in); int n=s.nextInt(); int a[]=new int[n]; int b[]=new int[n]; for(int i=0;i

import math T=int(input()) for i in range(T): N=int(input()) a=int(math.log2(N)) b=2a if N==2: print(1) elif N==1: print(2) elif b==N: print(1) else: c=N-b d=int(math.log2(c)) print(min(c-2d,2**(d+1)-c))

## what is wrong in this code

2★ap628830
1
accept rate: 0%

 0 hii Do you send snack down code plese answered 12 Oct, 21:53 0★zawed123 1 accept rate: 0%

# include <stdio.h>

int main() { int T; char name[100]; int count ,count1,i; scanf("%d",&T); for(i=0;i<T;i++) { scanf(" "); gets(name);

for(int j=0;name[j]!='\0';j++)
{
if(name[j]=='R')
{
count1++;
}
else
{
count++;
}
}

if(count1==count)
{
printf("yes\n");
}
else
{
printf("no");

}
count=0;
count1=0;


} return 0; }

1
accept rate: 0%

# include<math.h>

long long int prime(long long int ); long long int sum_factor(long long int );

long long int prime_no(long long int p) { long long int h; for(h=2;h<p;h++) { if(p%h==0) { break; } } if(h==p) return(p); else return(0); }

int main() { long long int t,l,r,i,d,b;

scanf("%lld",&t);
while(t--)
{
long long int sum=0;

for(i=l;i<=r;i++)
{
b=2;
d=1;
do
{
d=pow(b,2);
if(i%d==0)
{
d=0;
break;
}
b=b+1;

}while(i>=d);

if(d==0)
continue;
else
{
sum+=sum_factor(i);

}

}
printf("%lld\n",sum);
}
return 0;


}

long long int prime(long long int a)

{ long long int s[a],y=0,k,m,c=0;

for(k=2;k<=a;k++)
{
m=prime_no(k);
if(m>0)
{

s[y]=m;
y++;
}
}
for(k=0;k<y;k++)
{
if(a%s[k]==0)
{
c++;
}
}

c=prime_no(c);

if(c>0)
return (a);
else
return (0);


}

long long int sum_factor(long long int x)

{ long long int sm,j,res; sm=0; for(j=1;j<=x;j++) { if(x%j==0) { sm+=j; } }

res=prime(sm);
return (res);


}

472
accept rate: 0%

 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×243
×206
×196

question asked: 21 Jun '12, 11:08

question was seen: 48,499 times

last updated: 18 Nov, 23:22