ACM and Computer Science (Wally Yang)
Inverse Factorial (Alex Li)
Given the value of n
th Fibonacci number (which can be very large), can you write a program to find the value of n
? The 1st..5th Fibonacci numbers are: 1, 1, 2, 3, and 5.
Sample input:
267914296
Sample output:
42
Test input:
1545546358982889298834255636905056803477627151920...
The Eight Queens Puzzle is to place eight queens on an 8x8 chessboard so that no queen can attack another. Your job is to verify a solution to the puzzle.
Sample input:
*.......
..*.....
....*...
......*.
.*......
.......*
.....*..
...*....
Sample output:
invalid
Sample input:
*.......
......*.
....*...
.......*
.*......
...*....
.....*..
..*.....
Sample output:
valid
Source: 2014 ICPC NAQ
In addition, it is calculatable that, there are 92 ways of placing eight queens.