Re: [algogeeks] test cases

2012-11-10 Thread rahul

On Oct 17, 2012 2:46 PM, "w.s miller" 
wrote:

> Hi,
>
> You are given N numbers. You have to perform two kinds of operations:
> U x y - x-th number becomes equal to y.
> Q x y - calculate the sum of distinct numbers from x-th to y-th. It means
> that the sum for the set {1, 2, 3, 2, 7} will be equal to 13 (1+2+3+7).
> Input
>
> The first line of input contains an integer N. 1<=N<=5
> The second line consists of N numbers.
> The third line consists of an integer Q. 1<=Q<=10
> The following Q lines will consist of queries of the form described in the
> task description.
> All numbers in input will fit in the signed 32-bit type.
> Output
>
> Output an answer for every query of the second type.
> Here is my code .But it is giving the wrong answer.Can anybody suggest me
> the test cases where it is giving Wrong Answer..
>
> #include
> #include
> int main()
> {
> int list[5],i,n,j,sum,k,l;char c;long t;
> scanf("%d",&n);
> for(i=0;i {
> scanf("%d",&list[i]);
> }
> scanf("%ld",&t);
> while(t)
> {
> sum=0;
> fflush(stdin);
> scanf("%c",&c);
> scanf("%d%d",&k,&l);
>
> if(c=='Q' && (k<=l))
> {
> for(i=k-1;i {
> for(j=i+1;j {
>if(list[i]==list[j])
>   break;
>else if((j==l-1) &&(list[i]!=list[j]))
>{
>   sum=sum+list[i];
>}
> }
>  }
>  printf("%d\n",sum+list[l-1]);
>  }
>  if(c=='U')
>  {
>  list[k-1]=l;
>  }
>  t--;
> }
> return 0;
> }
>
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Can anybody specify why we require linker scripts? Is it for optimization? If it is, what optimization can we expect?

2012-11-10 Thread Soumya Prasad Ukil
-- 
regards,
soumya prasad ukil

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.