C/C++ user : Take input in a char array or string(if using C++) : a now do string addition. : a = a + a; now do string substraction. : a = a - 2.
Java user : Use BigInt class On Fri, Feb 4, 2011 at 8:12 PM, Logic King <crazy.logic.k...@gmail.com>wrote: > please help me solve the problem on SPOJ > > https://www.spoj.pl/problems/BISHOPS/ > > > The logic of the problem is very easy i.e. 2*n-2 > but i am getting WA bcoz i am not able to deal with the large inputs.[?] > plz help me how to get this AC......... > > > #include<stdio.h> > int main() > { > long long int n,bmax; > while(scanf("%lld",&n)!=EOF) > { > if(n==1) > printf("%d\n",1); > else > { > bmax=(2*n)-2; > printf("%lld\n",bmax); > > } > } > 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<algogeeks%2bunsubscr...@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.
<<325.png>>