Page 1 of 1

10208 - Liar or Not Liar that is the...

Posted: Sat Jan 26, 2002 2:51 pm
by Adrian Kuegel
Can someone, who has solved this problem, please give me the correct output for
4
10!
Thanks in advance!

Posted: Sun Jan 27, 2002 2:53 am
by shahriar_manzoor
He might be honest.

He is a liar.
7

Posted: Sun Jan 27, 2002 5:28 pm
by Adrian Kuegel
Thank you. I have now solved the problem.
I had thought that the sides have to be >0, and therefore printed
4 ->he is a liar

10208 - WA

Posted: Sun Feb 29, 2004 2:21 am
by txandi
I can't find out what's wrong in my program... it seems to work well but when I summit it, I get WA :(

Can anyone give some inputs/outputs to check if my program is correct?

Thanks for all!

PD: I'm new here... Can I send my code to someone in order to check if it's ok? Or can anyone tell me what I have to do to see which is my wrong answer?

Thanks again!

Posted: Sun Feb 29, 2004 8:50 am
by ..
I just solved this question.
At first I get 4 WA.....I don't understand why.

As I know that Shahriar Manzoor always design tricky data,
I modified my code to answer
"He might be honest." if the input is N and it is a square number.
For example, if the input is 4, you need to answer "honest".

Then I get accepted.
BUT!! How can a "right-angled triangles" have an edge length zero??? :evil:

Posted: Tue Mar 02, 2004 10:05 pm
by txandi
It works, the side can be 0!!!

Thanks!

10208 crazy shariar

Posted: Tue Sep 07, 2004 8:05 am
by harry
can any body tell me what is the output of the following input
10000000
10000000!

Here
4<=N<=10000000
hope N!=0

thanks in advance.

Posted: Tue Sep 07, 2004 12:05 pm
by Per
My output:

Code: Select all

He might be honest.

He is a liar.
7 11 43 47 59 67 71 83 131 151 163 191 283 307 311 347 367 383 443 479 487 491 503 571 599 607 619 659 691 719 727 739 811 827 883 887 907 967 1039 1051 1063 1087 1091 1123 1151 1163 1187 1231 1303 1423

Posted: Tue Sep 07, 2004 6:04 pm
by harry
thanks for the reply.
my output are same as yours.
but w.a.
any tricky input plz.
thanks in advance.

some input to try

Posted: Thu Jul 14, 2005 1:18 pm
by jdmetz
If you are still having trouble, try these input.

Input:

Code: Select all

884!
7816782!
9999991
9999971
9999965
9999895
9999819
9999729
9840769
9728161
Output:

Code: Select all

He is a liar.
11 23 67 79 151 163 167 223 227 239 251 263 271 283 443 463 467 479 487 491 499 503 523 547 563 571 587 599 607 619 631 643 647 659 683 691 719 727 739 743 751 787 811 823 827 839859 863 883

He is a liar.
19 79 83 139 179 199 211 223 307 359 367 419 439 467 499 647 739 751 811 839 859 863 887 907 911 967 983 1063 1087 1279 1303 1439 1447 1483 1487 1499 1523 1567 1579 1607 1667 17591823 1831 1871 1999 2003 2027 2083 2099

He is a liar.

He is a liar.

He might be honest.

He is a liar.

He is a liar.

He might be honest.

He might be honest.

He might be honest.

10208 I don't understand...

Posted: Tue Aug 01, 2006 7:49 am
by s000015
Output:

Code: Select all

Apart from that you also need to print the prime numbers with which you need to divide N! to make it the square of a valid largest side of one of his lands.
Sample I/O:

Code: Select all

4!

He is a liar.
3
but 4!/3 = 8, 8 isn't a square of a valid largest side...

Posted: Tue Aug 01, 2006 10:04 am
by mf
Why, 8 = 2^2 + 2^2, so 8 is the square of hypotenuse of a right triangle with legs 2 and 2.

10208(Liar or not Liar) Helppppppppp

Posted: Thu Aug 24, 2006 4:01 pm
by Shuvra(CSE-BUET)
I found the problem very odd. I can't understand how to solve this. How can prime factorization help me here? I could not find the pattern.
It is not possible like prob. 106 to generate and check x,y,z tripple.
Funny thing is that Shahriar Manzoor has a very big heart ,and so always deals with very big number like 10000000! .
Ha ha ha.......
:D

Re: 10208 - Liar or Not Liar that is the...

Posted: Fri Dec 31, 2010 11:19 am
by suneast
Thx so much to U all... :D
I finally got ac after passed the test case pase above...

I found that, the problem is just about sieve the prime factors and check the factor is SQUARE or not :wink:

Code: Select all

O(NlogN) time to make a prime table till 10^7
consider that: a^2 + b^2 = c^2
if a = m^2 - n^2, b= 2mn, c = m^2 + n^2
the format above is fine, so we just need to enum m,n to get "c"
we can initiate the table fine[c], like

Code: Select all

#define MAXN 10^7
for( i:1->INF)
   if(i*i>MAXN) break
      for( j:i->INF)
	     if(i*i+j*j>MAXN) break;
		 else fine[i*i+j*j]=true
N(N!):

Code: Select all

factorize N (N!), into p1^n1 *... pi^ni * ....
if( ni is odd && fine[pi]=false ), "He is a liar."
otherwise, "He might be honest."
if the input is N!, just store no more than 50 pi,
and finally output
done!
more : if N is SQUARE the answer is always "He might be honest." :wink: