Problem 3Problem code: CME03 |
Louie, Douie and Huie want to open a lemonade stall so that they can earn their pocket money. However, Uncle Scrooge being a skinflint miser, has refused to invest a single dime in their business. That s the trouble with you young scalawags of today...you expect to start in the top instead of working up from the bottom, like I did!' was what Uncle Scrooge had to say on hearing of their brilliant plan. The nephews start discussing alternative ways of obtaining the necessary capital. Louie tells that he heard Gyro discussing the safety scheme of Scrooge's new piggy bank. The piggy bank has two locks which need to be supplied with positive numbers a and b with a < b which satisfy the condition a^ 2 + b^2- ab = the number on the safe. Douie knows that Gyro issued a book on prime numbers from McDuck Library and checking with the book finds that the number on the safe is prime. He also finds out from the book that only primes of the form 3t+1 can be written in this form. Now it is up to you to help Huie to put a and b together and crack the safe to start the lemonade business.
Input
Number of primes The primes can have at most 10 digits.
Output
Numbers a b (values separated by a single space and each line ends with a new line character)
Example
Input: 1 7 Output: 7 2 3
| Author: | vishesh_sigma |
| Date Added: | 28-01-2010 |
| Time Limit: | 50 sec |
| Source Limit: | 50000 Bytes |
| Languages: | ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.0.0-8, CPP 4.3.2, CS2, D, ERL, F#, FORT, GO, HASK, ICK, ICON, JAR, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.1.2, RUBY, SCALA, SCM guile, SCM qobi, ST, TEXT, WSPC |
Comments

Fetching successful submissions

Input: " Number of primes
Input: " Number of primes The primes can have at most 10 digits." (Unclear !)
Output : "Numbers a b" .. then why 3 numbers are there in the output ?
Isn't (1,3) also a solution
Isn't (1,3) also a solution ?
1^2+3^3-1*3 = 1+9-3 = 7