Search found 4 matches

by shawon10
Thu May 21, 2015 4:39 pm
Forum: Volume 118 (11800-11899)
Topic: 11805 - Bafana Bafana
Replies: 23
Views: 12305

Re: 11805 - Bafana Bafana

Got Accepted :D . There Was a little bug in my code as i took if condition at first. but now it's working

#include <stdio.h>
int main()
{
int n,k,p,t,i,j;
scanf("%d",&t);
for(i=1;i<=t;i++)
{
int f=0;
scanf("%d %d %d",&n,&k,&p);
int j=k;
while(f!=p)
{
f++;
j++;

if(j>n)
{
j=1 ...
by shawon10
Thu May 21, 2015 3:36 pm
Forum: Volume 118 (11800-11899)
Topic: 11805 - Bafana Bafana
Replies: 23
Views: 12305

Re: 11805 - Bafana Bafana

i tried my code by several test cases but still i am getting WA. i don't know why there are some test cases which is not valid like 12 14 18 as k<=n according to question. when k>=n my code is not showing correct outout. should i consider k>n but why?

#include <stdio.h>
int main()
{
int n,k,p,t,i ...
by shawon10
Wed Feb 04, 2015 10:51 am
Forum: Volume 114 (11400-11499)
Topic: 11462 - Age Sort
Replies: 49
Views: 27948

Re: 11462 - Age Sort

brianfry713 wrote:Read this thread.
Yes.. for 100000 this code is not running. but how can i fix Time Limit Exceed in this code?
by shawon10
Tue Feb 03, 2015 6:24 pm
Forum: Volume 114 (11400-11499)
Topic: 11462 - Age Sort
Replies: 49
Views: 27948

Re: 11462 - Age Sort

why Time Limit Exceed?

#include <stdio.h>
int main()
{
int n,*a,i,j,t;

while(scanf("%d",&n)!=EOF)
{
a=(int*)malloc(sizeof(int)*n);
if(n==0)
{
break;
}
for(i=0;i<n;i++)
{
scanf("%d",(a+i));
}
for(i=0;i<n;i++)
{
for(j=i+1;j<=n;j++)
{
if(*(a+i)>*(a+j))
{
t=*(a+j);
*(a+j)=*(a+i ...

Go to advanced search