You are not logged in. Please login at www.codechef.com to post your questions!

×

time limit exceeded in my code plz help me.......questn link is http://www.codechef.com/problems/AMSGAME1

include<stdio.h>

int check(int *,int); int main() { int t,n,x; scanf("%d",&t); while(t--) { scanf("%d",&n); int p[1000]={0},j; for(j=0;j<n;j++) {="" scanf("%d",&p[j]);="" }="" x="check(p,n);" while(x="=0)" {="" x="check(p,n);" }="" printf("%d\\n",x);="" }="" return="" 0;="" }="" int="" check(int="" *p,int="" n)="" {="" int="" i,min,max,t="0;" min="max=p[0];" for(i="1;i&lt;n;i++)" {="" if(p[i]<min)="" min="p[i];" if(p[i]="">max) { max=p[i]; t=i; } } if(min==max) return min; else { p[t]=max-min; return 0; } }

asked 04 Jul '14, 14:16

ashubaba's gravatar image

2★ashubaba
1
accept rate: 0%

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • 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:

×2,475

question asked: 04 Jul '14, 14:16

question was seen: 713 times

last updated: 04 Jul '14, 14:16