FP - Finding password
Bom has a list of n favorite numbers which are birthday, driving license, passport number, etc After creating an email account, Bom wants to choose a password as the largest number P among all possible numbers generated by the combinations of k (1 <= k <= n) positive numbers in the favorite list so that P is divisible by 9.
Your task is writing a program to help find P the password for Bom’s email.
The first line contains a positive integer T as the number of test cases in the input file. The
following lines describe information of each test case including:
• One line containing two positive integers n and k,
• n following lines are n favorite numbers.
The output file contains T lines; each line is the solution of the corresponding test case that is
either password P or -1 in case of not finding a feasible number.
T <= 30
1 <= k <= n <= 100
1 <= all favorite numbers <= 10^6
No since you have to combine k numbers and k is 2 in that example
in the second sample case,the output should be 432.right??
Prabhu Dayal Sahoo:
Very strict time time limit I guess. STL string gives TLE.
those getting wrong ans check for
i need solution for FP-finding password.please i try a lot.but i don't get the solution.please urgent
Last edit: 2014-06-30 19:58:59