Show all threads Hide all threads Show all messages Hide all messages |
WA5 Solution | Țigoan Matei | 1502. Domino Dots | 6 Dec 2020 14:40 | 1 |
Since N is as big as 10000 the solution for N = 10000 exceeds unsigned long so you should use big numbers (put the numbers in arrays and then do the operations on the arrays) https://www.infoarena.ro/lucrul-cu-nr-mari |
Почему на Паскале не проходит???????????????? | IT | 1502. Domino Dots | 11 Nov 2020 12:29 | 2 |
var n:integer; s:real; begin read(n); s:=n*((n+1 )/2)*(n+2); write(s); end. округли 'round' У тебя 12.0 не пройдет,а надо 12 |
вопрос снят | Desserg | 1502. Domino Dots | 26 Nov 2019 11:31 | 2 |
Edited by author 26.11.2019 11:33 Как удалить тему? Edited by author 26.11.2019 11:32 Edited by author 26.11.2019 11:32 |
Wrong answer!!! Help pls | Levchuk_vs16 | 1502. Domino Dots | 23 Jun 2019 16:26 | 2 |
var n:integer; s:real; begin read(n); s:=(n+2)*((n+1)*n)/2; write(s); end. Use "longint" and not "integer" or "real". |
Formula | Ormanov Meirkhan | 1502. Domino Dots | 15 May 2017 17:31 | 1 |
Formula Ormanov Meirkhan 15 May 2017 17:31 |
Tests | fff1405 | 1502. Domino Dots | 27 Dec 2015 21:36 | 1 |
Tests fff1405 27 Dec 2015 21:36 1000 => 501501000 500 => 62875500 333 => 18629685 1 => 3 3 => 30 4 => 60 and use long long =) |
Help to understand!! | Desire | 1502. Domino Dots | 27 Nov 2015 01:20 | 2 |
I know i am stupid but help me to understand this formula! n*(n+1)/2*(n+2) Edited by author 02.11.2013 03:06 Edited by author 02.11.2013 03:12 This formula is equivalent to the this sum: sum(i=0 -> N) sum(j=i -> N) (i + j) Edited by author 27.11.2015 01:21 |
Formula is good but.... | competitivecoder | 1502. Domino Dots | 4 Nov 2015 14:18 | 1 |
He guys if you can't come up with any formula...pre-computation will do the job.I could not come up with any formula so I used precomputation and AC in 0.015 sec.Good luck :) |
Can anybody explain the example... | Urrong | 1502. Domino Dots | 12 Jun 2015 03:17 | 4 |
i cant find 12 distinct combinations if N = 2... i can only think of: 0-0 0-1 0-2 1-1 1-2 2-2 That are only 6 combinations... what did i miss? 0-0 (0+0=0) 0-1 (0+1=1) 0-2 (0+2=2) 1-1 (1+1=2) 1-2 (1+2=3) 2-2 (2+2=4) | 0+1+2+2+3+4=12 got it? but how does the formula N*(N+1)/2*(N+2) comes ? pls explain... :) The problem does not ask you to count the # of distinct dominoes in a set, it asks you to count the # of dots on a complete set. |
Wrong answer in Java 1.7 | Axmadjon | 1502. Domino Dots | 1 May 2014 12:33 | 1 |
import java.util.Scanner; public class AcmTimusRu { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); System.out.println(n * (n + 1) * (n + 2) / 2); } } |
AC | Saligzhanov_KB_13 | 1502. Domino Dots | 14 Dec 2013 05:30 | 1 |
AC Saligzhanov_KB_13 14 Dec 2013 05:30 Hey, guys, i've did it! No need to be so smarty, just use long long :) Formula is obvious and it already somewhere in this forum, so you can find it USE LONG LONG! |
Test | Zeva [USU] | 1502. Domino Dots | 30 Jul 2013 17:55 | 18 |
Test Zeva [USU] 28 Oct 2006 17:07 1000 => 501501000 500 => 62875500 333 => 18629685 1 => 3 3 => 30 4 => 60 But Wa#5 Edited by author 28.10.2006 17:09 The same with me: WA#5 can anybody tell me why Re: Test emotional blind 28 Oct 2006 17:30 Re: Test emotional blind 28 Oct 2006 17:31 Re: Test Madiyar Tursunbayev 29 Oct 2006 12:11 Just use int64 instead of longint; Re: Test Todor Tsonkov 30 Oct 2006 16:02 My solution is very short and I also get WA5, my answers are the same as those posted, can anyone give some hint ? Re: Test USTU-FTF KOIBAS Team 30 Oct 2006 16:30 I got Accepted using BrutForce!!! Re: Test Todor Tsonkov 30 Oct 2006 17:02 Already solved this problem, read the hint below :) Edited by author 30.10.2006 21:20 Re: Test N.M.Hieu ( DHSP ) 30 Oct 2006 18:28 Yes , me , too . WA#5 but AC now , you should change "int n" into "long long n" . Re: Test Todor Tsonkov 30 Oct 2006 21:20 Yup, 10x pal, you saved me from reading again and again this task and to wonder where I was wrong :) WA on 5 Alexander Prokazyuk (TKTL) 2 Nov 2006 07:17 Who can find my mistake? [code deleted] it passes all my tests, but it can't pass 5 Edited by moderator 29.12.2006 09:16 This is my formula for (int i = 0; i <= n; ++i) res += (i + n) * (n - i + 1) / 2 + i * (n - i + 1); This one is mine: n*-~n*-~-~n>>1 Have fun! Re: WA on 5 Mihran Hovsepyan <<RAU>><<1 kurs>> 8 Nov 2007 16:00 Re: Test Petromil Petkov 10 Nov 2006 01:00 Thanks for the advice. Could you tell me what brings this change? n=10000 fits in an int, doesn't it? Ha! Got accepted only with __int64 and not with long long... my djgpp returns a compilation error on such a line... could anybody explain me what should that be? Edited by author 10.11.2006 01:16 Edited by author 02.03.2008 12:54 Edited by author 02.03.2008 12:53 |
Careful with the i/o system u use for test N#5 | HeypaBHoBeceH | 1502. Domino Dots | 16 Jul 2013 05:10 | 3 |
I didn't get accepted until I switched printf() with cout. I used %lld for the format of printf and still it got WA. Same formula, same code, just that i used cout/cin and I got AC. I used printf with "%llu" and got AC the first attempt. u - unsigned d - digit (signed) |
it is very easy | mariam kupatadze | 1502. Domino Dots | 6 Feb 2013 22:17 | 4 |
In paskal when n=10000 you can not write this expression n*(n+1)*(n+2)/2 in some variables it is very long and big number so in C++ it is very easy just write(here is my AC program): #include <cstdlib> #include <iostream> using namespace std; int main(int argc, char *argv[]) { long long n; cin>>n; cout<<n*(n+1)*(n+2)/2<<endl; system("PAUSE"); return EXIT_SUCCESS; } Edited by author 27.04.2008 17:47 In Pascal you can use Int64 why is it true? can u explain me please?) |
My formula | PrankMaN | 1502. Domino Dots | 16 Oct 2012 15:22 | 3 |
Answer for n is n*(n+1)/2*(n+2) For example if n=2 then answer is 2*3/2*4=12 The formula is correct and is easily proven by solving the sums: sum(i=0 -> N) sum(j=0 -> N) (i + j) Edited by author 03.02.2012 17:25 Actually the inner sum needs to start at i, not at zero. Starting at 0 counts non-double dominoes twice. |
Why 0.015? | partisan | 1502. Domino Dots | 16 Oct 2012 15:15 | 2 |
My program only read integer and write integer (ready formula). Why it works 0.015 sec? Edited by author 11.06.2009 00:15 Because this is the minimum measurement time possible on the current version of the judge. |
Way WA#5????? please help | Alireza_Keshmiri | 1502. Domino Dots | 16 Nov 2011 03:31 | 4 |
Edited by author 21.02.2009 18:37 Maybe because the answer is a very large number, more than INT_MAX. int sum; // WA 5 long long sum; // Accepted (int64) |
Some tests | Andrew Hoffmann aka SKYDOS [Vladimir SU] | 1502. Domino Dots | 5 Jul 2011 02:35 | 2 |
Some tests Andrew Hoffmann aka SKYDOS [Vladimir SU] 6 Aug 2010 15:08 100 => 515100 1000 => 501501000 9999 => 499999995000 7779 => 235455472110 1234 => 941825820 Good luck! Thanks. This tests very much help to me |
What's wrong here? | Xysia | 1502. Domino Dots | 20 Feb 2010 20:12 | 2 |
All codes listed below works good on my computer (and they give correct answers), but when submitting I get: Code #1: --------------------------------------------------------- #include<stdio.h> #include<iostream.h> int main() { long long n; cin>>n; long long wynik; wynik=(n*(n+1)*(n+2))/2; cout<<wynik<<endl; return 0; } ---------------------------------------------------------- Compilation error Code #2: removed iostream.h and replaced cin and cout with scanf("%lld",%n); and printf("%lld\n",wynik); WA on test 5 Code #3: same as #2, but with printf("%0.lf\n, (double)wynik); instead WA on test 1 ----------------------------------------------------------- All those programs work and give correct results on my computer. What's wrong here? Please help. For The First Code : Add using namespace std; for using cin & cout. |
Wrong answer test#5 | GulfStream | 1502. Domino Dots | 8 Nov 2009 03:46 | 5 |
Here my solution: --- end. I can not understand that incorrectly. Help somebody))))))) Edited by author 08.11.2009 03:46 The answer for 10000 is as large as 500150010000 The answer for 10000 is as large as 500150010000 What type to use? The biggest it longInt. 500150010000 does not enter there. |