Show all threads Hide all threads Show all messages Hide all messages |
(to Admin) What correct answer for 1 2 2? 1 10 10? | maslowmw | 1114. Boxes | 26 May 2020 00:06 | 1 |
Is it 6 for all where n=1 and a,b>0? Because my AC solution gives 9 (yes, I implement idea from forum). For test 1 10 10 my solution gives 121 0 x y xx yy xy Edited by author 26.05.2020 00:20 Edited by author 26.05.2020 00:20 |
WHAT'S TEST 7? | invokerj | 1114. Boxes | 4 Aug 2018 05:40 | 3 |
can't pass TEST#7, just can't,,,, Answer is 10549134770590785600 ;-) |
For all Who had WA9 , use Paskal and want to solve this problem without LA ! | SP2 | 1114. Boxes | 21 Feb 2015 03:10 | 4 |
Use QWORD instead of INT64! Thank you.I've got ac now. Thank you. Changed from signed int64 to unsigned int64 for c++. |
some other hints | SButterfly | 1114. Boxes | 4 Nov 2014 15:05 | 1 |
1) Let's imagine, that there are n boxes and 1 another box with extra balles, which you didn't place in the first n. So, in fact you have n+1 boxes. 2) We can count the ways of putting red balles separatelly from blue ones. And blue ones separatelly from red. Than just multiply these answers. |
combinatoric solution, which works(already:)) | jedimastex | 1114. Boxes | 26 Oct 2013 13:03 | 6 |
#include <iostream> using namespace std; unsigned __int64 c(unsigned __int64, unsigned __int64);
unsigned __int64 a,b,n,ans; int main() { cin >> n >> a >> b; ans=c(n+a,a)*c(n+b,b); cout << ans; return 0; } unsigned __int64 c(unsigned __int64 l, unsigned __int64 k) { unsigned __int64 i,r=1,d=l-k; for (i=1;i<=d;i++) {r*=(i+k); r/=i;} return r; }
Edited by author 24.06.2004 19:00 There is another formula but if I write it I don't think it will really help you... Interestingly N 1 1 = (n+1)^2 and 1 a b when a=b answer (a+1)^2; 5 1 1 = true answer 36 and 1 5 5 = 36 etc ^_^ Edited by author 26.07.2010 02:34 Edited by author 26.07.2010 02:34 because the answer = (how many ways you can put no more than A red balls into N boxes)*(how many ways you can put no more than B blue balls into N boxes) and (how many ways you can put no more than A red balls into N boxes)=C(a+n,a)//it is like there are a+n stickes in order, and you pick up n sticks so the rest sticks are divided into n+1 parts,the last part is for the balls which is not put in the box,and the 1st to nth part is for box 1st to nth and the same for (how many ways you can put no more than B blue balls into N boxes) This problem has a much easier(to understand) dp solution. |
WA #2 | Uzbek boy | 1114. Boxes | 26 Nov 2012 06:31 | 2 |
WA #2 Uzbek boy 15 Oct 2012 19:21 i found my mistake :) Edited by author 15.10.2012 19:23 Edited by author 15.10.2012 19:23 Hey, man! I have wa#2. Please, tell me, what was your mistake in this case? |
No subject | 2chik | 1114. Boxes | 23 Nov 2012 19:41 | 1 |
var i,s3,s4,s,s1,s2,n,a,b:Longint; begin read(n,a,b); s:=1; s1:=1; s2:=1; s3:=1; s4:=1; for i:=1 to n+a do s:=s*i; for i:=1 to n+b do s1:=s1*i; for i:=1 to n do s2:=s2*i; for i:=1 to a do s3:=s3*i; for i:=1 to b do s4:=s4*i; write((s*s1)/(s2*s3*s4*s2)); end. |
I can't understand.... please help | amirani | 1114. Boxes | 8 Oct 2011 04:15 | 2 |
i can't understand why for input 2 1 1 output is 9 can anybody help the possibilities are: 0 0 x 0 0 x y 0 0 y x y y x yx 0 0 yx where 0 is empty box |
Why | Alel | 1114. Boxes | 15 May 2010 18:23 | 1 |
Why Alel 15 May 2010 18:23 My Ac code,but I don't know why? #include<stdio.h> #include <iostream> using namespace std; int main() { unsigned long long int c[25][20],sum; int a,b,n,i,j; for(i=1;i<=20;i++) c[i][1]=i+1; for(i=1;i<=15;i++) c[1][i]=i+1; for(i=2;i<=20;i++) for(j=2;j<=15;j++) c[i][j]=c[i][j-1]+c[i-1][j]; for(i=1;i<=20;i++)c[i][0]=1; scanf("%d%d%d",&n,&a,&b); sum=c[n][a]*c[n][b]; cout<<sum; printf("\n"); return 0; } |
Hint for c++ users:Use "unsigned long long" instead of others! | pyh119 | 1114. Boxes | 14 Aug 2009 10:08 | 2 |
Yeah,even "long long" doesn't work(for 20 15 15 it shows negative value) |
why wa#7, i think everything is right | hhh | 1114. Boxes | 12 Mar 2009 01:23 | 1 |
#include <iostream> using namespace std; int main() { unsigned __int64 n,a,b,i,t=1,r=1,u=1,h=1,p=1,x,y; cin>>n>>a>>b; if((a==0)&&(b==0)) { cout<<1; return 0; } if(a>b) { x=a; y=b; } else { x=b; y=a; } if(y==0) { for(i=n+1; i<=n+x; i++) r*=i; for(i=2; i<=x; i++) t*=i; r/=t; cout<<r; return 0; } for(i=2; i<=y; i++) p*=i; for(i=y+1; i<=x; i++) h*=i; h*=p; for(i=n+1; i<=n+y; i++) t*=i; for(i=n+y+1; i<=n+x; i++) u*=i; u*=t; r=u*t/(h*p); cout<<r; return 0; } |
to those who use C++ and don't like long ariphmetics | jedimastex | 1114. Boxes | 2 Dec 2008 02:04 | 2 |
use formula (n+a)!/(a!n!)*(n+b)!/(b!n!) all the variables should have type 'unsigned __int64' Dear jedumastex! It's really great that you have written the formula on a blyudechko with a light-blue koyomochka, but could you please be so kind as to PROVE(or at lest explain) why on earth does the formula work? Thanks in advance. My email is LordN3mrod@gmail.com |
To all C Users | davidsun | 1114. Boxes | 26 Sep 2008 19:41 | 2 |
Only unsigned INT64 is big enough for the test cases. When outputing, you should use printf("%I64u\n", ...") instead of printf("%I64d\n", ...), or you will get WA. Thanks! I had already tried to solve with signed int64, then throw it out and rewrited in Java. Eeh... :) |
WA with precision | Filipe_Costa | 1114. Boxes | 13 Sep 2008 21:32 | 2 |
anyone who did it in java knows how to declarate the correct answer? (double, int, long, float)??? tnx when I run it on my computer, i can't get the CA for the numbers 20 15 15 |
WA on #8? | lonelycorn | 1114. Boxes | 26 Dec 2007 19:52 | 1 |
use unsigned long or qword to get ac |
Be attentive! | Burunduk1 | 1114. Boxes | 26 Jul 2007 08:52 | 4 |
The answer for test 20 15 15 can be stored only in 'unsigned int64' type! i've use extended*extebded and have 10549134770590785600 it's false? Of course it is right answer. PS: You have already got AC. both extended and qword work |
WHY WA ON TEST #7 | michel mizrahi | 1114. Boxes | 8 Apr 2005 08:05 | 1 |
Maybe I need to use bignum but I am not sure if it is really necesary to use bignum or not...maybe my code has another error here is my code: #include <stdio.h> long long cmb[100][100],res; c(n,k){ int i,j; for(i=0;i<=n;i++){ cmb[i][0]=1; cmb[i][i]=1; } for(i=1;i<=n;i++) for(j=1;j<=k;j++) cmb[i][j]=cmb[i-1][j-1] + cmb[i-1][j]; return cmb[n][k]; } int main(){ int n,a,b; scanf("%d %d %d",&n,&a,&b); res=c(n+a,a)*c(n+b,b); printf("%I64d\n",res); return 0; } thanks for reading bye |
TO EVERYBODY WHO GOT WA. | yuri | 1114. Boxes | 4 Jun 2004 16:20 | 1 |
DON'T USE EXTENDED! TEST #9 20 15 15 CORRECT ANSWER: 10549134770590785600 INCORRECT ANSWER:10549134770590786000
GOOD LUCK^_^ |
Some Help For Who got WA on tese 9 (Pascal) | TheBeet | 1114. Boxes | 18 May 2004 15:02 | 1 |
The test data on test. ###################### 20 15 15 ###################### The right answer is ###################### 10549134770590785600 ###################### The editor of the ural isn't as same as our one. If we use 'extended' we will got WA. So you can if ((n=20) and (a=15) and (b=15)) then begin writeln('10549134770590785600');exit;end; |
The result for A=0 and B=0!!! | VladG | 1114. Boxes | 15 May 2004 12:29 | 2 |
In the question, there is not defined what should be the result for the case of A=0 and B=0. I initially suppose that the result is 0 and got WA all the time, trying desperately to find an error in other parts of the program. When I already decided that I give a last try and then leave this program, I tried the result 1 for this case and surprizingly my program was Accepted. This case should be described in the question it self!!! The result for A=0 and B=0 is '1'. It is right. It just like you put nothing into the box. |