Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения |
WHAT IS IN TEST #6 | shota zedashidze | 1402. Коктейли | 7 май 2021 02:43 | 7 |
I have the same problem. I printed "endline" after answer. Where did you print endline ? I have the same problem - WA6... |
what's wrong with my code? | yungyBaSe | 1402. Коктейли | 26 дек 2018 20:48 | 1 |
#include <iostream> #include <cmath> using namespace std; int fac(int n){ if (n==0){ return 1; } else { return n*fac(n-1); } } int wtf(int n,int k){ return fac(n)/fac(n-k); } int cock(int n){ int sum; for (int i=2;i<=n;i++){ sum += wtf(n,i); } return sum; } int main() { int n; cin >> n; cout << cock(n); return 0; } |
for anyone who has WA#13 | Najmaddin Akhundov | 1402. Коктейли | 11 дек 2018 11:31 | 3 |
use "long double" and to avoid rounding when you print the result, use cout << fixed <<setprecision(0)<< result << endl; Can you explain us why long double accepted and why double get WA13 ? |
WA#13 | kxurshid | 1402. Коктейли | 22 июн 2013 17:14 | 6 |
WA#13 kxurshid 19 сен 2009 01:43 My code: #include <iostream> using namespace std; double fac(int n) { double l = 1.0; for(int i = 1; i <= n; i++) l *=i; return l; } double A(int m, int n) { return fac(m)/fac(m-n); } void main() { int n; double soni = 0; cin >> n;
for(int i = 2; i<=n; i++) { soni += A(n,i); }
cout.precision(0); cout << fixed << soni; } WA#13 Where is my mistake? pls help me i have met the same problem with u Precision Edited by author 28.01.2012 00:07 Edited by author 28.01.2012 00:07 primer 21=138879579704209680000 19=330665665962403980 20=6613313319248079980 0-1 2-2 3-12 4-60 5-320 6-1950 7-13692 8-109592 9-986400 10-9864090 11-108505100 12-1302061332 13-16926797472 14-236975164790 15-3554627472060 16-56874039553200 17-966858672404672 18-17403456103284402 19-330665665962403980 20-6613313319248079980 21-138879579704209680000 |
Test 19 | aaa | 1402. Коктейли | 22 июн 2013 17:11 | 3 |
What is the right answer in test 19 ? |
Punctuation error in russian version of problem condition | underminer | 1402. Коктейли | 30 янв 2013 00:12 | 2 |
In the fourth sentence they should insert a comma after the third word. Edited by author 30.01.2013 00:12 |
WA20 | Dmitrij | 1402. Коктейли | 13 май 2012 11:53 | 3 |
WA20 Dmitrij 8 май 2012 00:21 Can anyone explain me, why this code got WA20: program Project1; {$APPTYPE CONSOLE} uses SysUtils; var f : array[1..21] of extended; d, c : array[-1..21, -1..21] of extended; res : extended; i, j, k, n : integer; begin readln(n); res := 0; f[1] := 1; for i := 2 to n do f[i] := f[i - 1] * i; c[0][0] := 1; for i := 1 to n do for j := 0 to i do c[i][j] := c[i - 1][j] + c[i - 1][j - 1]; for i := 2 to n do res := res + c[n][i] * f[i]; writeln(res:0:0); readln;readln; end. But this code got AC: program Project2; {$APPTYPE CONSOLE} uses SysUtils; var n : integer; s : array[1..21] of string; begin s[1] := '0'; s[2] := '2'; s[3] := '12'; s[4] := '60'; s[5] := '320'; s[6] := '1950'; s[7] := '13692'; s[8] := '109592'; s[9] := '986400'; s[10] := '9864090'; s[11] := '108505100'; s[12] := '1302061332'; s[13] := '16926797472'; s[14] := '236975164790'; s[15] := '3554627472060'; s[16] := '56874039553200'; s[17] := '966858672404672'; s[18] := '17403456103284402'; s[19] := '330665665962403980'; s[20] := '6613313319248079980'; s[21] := '138879579704209680000'; readln(n); writeln(s[n]); end. In spite of the fact, that answers for second programm I took as the results of the first program :) Edited by author 08.05.2012 00:24 Simple school maths. Just one formula from combinatorics. Without any precalc. Edited by author 08.05.2012 23:38 This is not my question.I couldn't understend why writeln(res:0:0) got WA, but on all my tests it's OK.Now I think it's becouse of old version of compiler here. |
You can get WA13 because of an unsigned 64-bit integer (qword in pascal) is not enough for it | PrankMaN | 1402. Коктейли | 26 авг 2011 20:39 | 1 |
Ans for n=21 is bigger then max qword. Ans for n=20 is less then max qword. |
why | waterlink | 1402. Коктейли | 6 авг 2011 02:57 | 2 |
why waterlink 11 апр 2011 00:51 why is solution with long double not working, long double must have 18 digits according to ISO c++, which must be enough to solve this problem i've calculated everything using g++ and long double, and formed a constant and got AC, which means that system compiler is bad.. The solution for the hardest case is the number "138879579704209680000" which has 21 decimal digits. You are just a lucky guy :) Maybe, because of its terminating zeroes, who knows. |
This is a stupid question...!!! | Imran Yusubov | 1402. Коктейли | 27 июл 2010 03:13 | 2 |
Dose anyone know a better solution?I used big Ints for this task.Do anyone has a mathematic solution? I have mathematic solution. a[i]=i*a[i-1]+i*(i-1); - it's true |
HELP ME PLEASE | VOLNOREZ_(Mats_Vladimir_Orenburg_High_school_№1) | 1402. Коктейли | 10 апр 2010 15:09 | 4 |
HELP ME PLEASE VOLNOREZ_(Mats_Vladimir_Orenburg_High_school_№1) 19 сен 2007 18:11 I HAVE WA6 where my mistake??? program Project1402; {$APPTYPE CONSOLE} function factor(a:integer):int64; var i:integer; f:int64; begin f:=1; for i:=1 to a do f:=f*i; factor:=f; end; var i,n:longint; s:int64; begin readln(n); if n=21 then writeln('138879579704209680000') else begin s:=0; for i:=2 to n-1 do s:=s+factor(n) div factor(n-i); s:=s+factor(n); writeln(s); end; end. what program shud and what it output for test when n=1? ups above for test №5 :) for №6 -|-|- n=2? Edited by author 07.01.2008 18:51 answer for 1 is 0 and you will took AC. |
WA 13! PLS HELP! | bani4ka | 1402. Коктейли | 30 мар 2010 12:04 | 5 |
#include <iostream> using namespace std; int main() { int n; cin >> n; //if(n==1) { cout << 0 << endl; return 0; } unsigned long long p,s=0; for(int i=2;i<=n;i++) { p=1; for(int j=n;j>=n-i+1;j--) p*=j; s+=p; cout << p << " "; } cout << endl; cout << s << endl; //system("Pause"); return 0; } Edited by author 30.08.2008 20:06 Edited by author 30.08.2008 20:08 test 13 is 21 the correct answer is 4131306270 N = 21 ANS = 138879579704209680000 =) |
Please tell me what is wrong in my programm???????????!!!! | Atbasar(GBK) | 1402. Коктейли | 8 янв 2010 23:44 | 2 |
#include <iostream.h> long int fac(long int k) { int i,total=1; if(k==0) { return 1; } for(i=1;i<=k;i++) { total*=i; } return total; } int main() { long int n,total=0,i; cin>>n; { if(n<14) { for(i=2;i<=n;i++) { total+=fac(n)/fac(n-i); } cout<<total<<endl; } } if(n>14&&n<17) { for(i=2;i<=n;i++) { total+=fac(n)/fac(n-i); } cout<<total<<endl; } if(n==14) { cout<<"87178291200"<<endl; } if(n==17) { cout<<"355687428096000"<<endl; } if(n==18) { cout<<"6402373705728000"<<endl; } if(n==19) { cout<<"121645100408832000"<<endl; } if(n==20) { cout<<"2432902008176640000"<<endl; } if(n==21) { cout<<"51090942171709440000"<<endl; } return 0; } for example for 21 answer is 138879579704209680000 |
Please,help me. Is it right? | ahmedov(NUUz_2) | 1402. Коктейли | 29 сен 2009 20:29 | 3 |
0, 2, 12, 60, 320, 1950, 13692, 109592, 986400, 9864090, 108505100, 1302061332, 16926797472, 236975164790, 3554627472060, 56874039553200, 966858672404672, 17403456103284402, 330665665962403980, 6613313319248079980, 138879579704209680000 Edited by author 01.10.2009 17:05 |
WA#13 WHY? | snowfly | 1402. Коктейли | 14 июл 2009 09:56 | 1 |
#include<iostream> using namespace std; int fac[100000],ans[100000],len,alen; int main (void){ int n;cin>>n; alen=1; memset(ans,0,sizeof(ans)); for (int i=2;i<=n;++i){ memset(fac,0,sizeof(fac)); len=1;fac[0]=1; for (int j=n;j>n-i;--j){ for (int k=0;k<len;++k) fac[k]*=j; for (int k=0;k<len;++k) if (fac[k]>=10){ fac[k+1]+=fac[k]/10; fac[k]%=10; } if (fac[len]!=0){ ++len; if (fac[len-1]>=10){ fac[len]=fac[len-1]/10; fac[len]%=10; ++len; } } } for (int j=0;j<min(alen,len);++j) ans[j]+=fac[j]; if (alen<len){ for (int j=alen;j<len;++j) ans[j]=fac[j]; alen=len; } for (int j=0;j<alen;++j) if (ans[j]>9){ ans[j+1]+=ans[j]/10; ans[j]%=10; } while (ans[alen]!=0){ ++alen; ans[alen]+=ans[alen-1]/10; ans[alen-1]%=10; } } for (int i=alen-1;i>=0;--i) cout<<ans[i]; cout<<endl; return 0; } |
Test 20 | Lord | 1402. Коктейли | 6 июн 2009 12:04 | 3 |
Who knows which n is in test №20? What did you do to get AC? |
test data | lian lian | 1402. Коктейли | 10 апр 2009 02:09 | 2 |
if (n==1||n==2) what is the answer the subject? for 1 the answer is 0 for 2 the answer is 2 |
WA on test 13, Please help | Lev Panov | 1402. Коктейли | 10 апр 2009 01:58 | 6 |
This is my solution: #include <stdio.h> long double fact( long double n ) { if (n < 2) return 1; else return n * fact(n - 1); } int main( void ) { long double n, nfac, ans = 0, i;
scanf("%Lf", &n);
if (n < 2) { printf("0"); return 0; }
nfac = fact(n);
for (i = 2; i < n; i ++) ans += nfac / fact(n - i);
ans += nfac;
printf("%.0Lf", ans);
return 0; } WTF? Check your answers to maxtests: 21 => 138879579704209680000 20 => 6613313319248079980 PS: Idea of solution is correct, but you should store answer in suitable type ("long double" is not enough). Hmm, I actually have correct answers for n = 20 and 21. And "long double" is extremely big type, for example: 100 => 253686955560127297296368144135170000933446331847165085913916476338770833469945019420289324705338829425834316771115322447713278811189027647015804045741541818368 =)) What's wrong then? "long double" can store numbers about 10^{4000} but only first 19 digits are calculated right. Btw, I think, you use some else compiler, not Intel-C++, am I right? Yep, you're right: I use GNU GCC. Ok, I will try to use "long long" type. you are so stupid max n is 21 not 100 |
WA#14 | HCMUNS - Team CHANT - Sakigake Moto | 1402. Коктейли | 20 фев 2009 08:36 | 1 |
WA#14 HCMUNS - Team CHANT - Sakigake Moto 20 фев 2009 08:36 N=21 is test 13 right, and this is also the maximum N right. So what is it in test 14? |
2 Admins | Teacher30 | 1402. Коктейли | 14 фев 2009 17:26 | 5 |
Check submissions 2451465 2451467 2451474 Your system's answers: WA-14, AC, WA-13 In real these solutions give SAME answers on all tests. Please, answer me. Compiler for C++ = Intel C++ Compiler 7.0, which is adjusted to be compatible with Microsoft Visual Studio 7.0 Compiler for C# = Microsoft Visual C# 2008 version 3.5.30729.1 (.NET Framework 3.5) Why don't you use Microsoft Visual C++ 2008 ? I've already got a lot of troubles with this "adjusted to be compatible" compiler. It is known issue for ICL 7.0: printf("%I64d\n", (long long)1e15); produces output 2147483647 Hm... __int64 inf = floor(1e13); works OK but __int64 inf = 1e13; gets WA-13 Aaaa!!! What don't I know about reduction of types in C++ yet? :) |