×

# Getting wrong ans because of improper placements of modulo. Need Help

 0 I need To Find The Summation Of the Below Series: (n+1-1)C1+(n+2-1)C2+.........+(n+k-1)CK(Hint:(n+k-1)Ck=(n+k-1)C(K)+(n+k-1)C(k-1)) The ans should be printed as Modulo m Here n=Len and k=N and m=1000003  #include #define M 1000003 int main(){ int t=0; long long int sum=0,L,R,N,init=0,i=0,Len=0; scanf("%d",&t); while(t-- > 0){ scanf("%lld%lld%lld",&N,&L,&R); Len=R-L+1; if(R==L){ printf("%lld\n",N%M); } else if(N<=Len){ init=Len%M; sum=init; for(i=2;i<=N;i++){ //I think beacuse of improper placements of modulo m getting wromg ans init=((((init%M)*((Len%M+i%M-1)%M))%M)/(i%M))%M; //printf("%lld",init); sum=(sum%M+init%M)%M; } printf("%lld\n",sum); sum=0; } } //getch(); return 0;  } I am getting wrong ans because of improper placements of modulo asked 09 Apr '15, 12:04 35●2●13 accept rate: 0% 0★admin ♦♦ 19.7k●350●498●541

 0 @aniruddha_paul: I see that you have participated in the April'15 long contest and this post is a clear violation of the contest rule. Please, remove the post. In case you need help you can always google it or else wait for the editorials to come. @admin ++ answered 09 Apr '15, 16:01 320●1●2●15 accept rate: 0% how to remove it?? (09 Apr '15, 16:48) but my points also gt removed! (09 Apr '15, 16:49)
 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:

×1,056
×335

question asked: 09 Apr '15, 12:04

question was seen: 705 times

last updated: 09 Apr '15, 16:49