ICPC Miền Trung 2017-2018 - Bài F: Large Fibonacci
Đề bài
F. Large Fibonacci
Standard I/O | Time Limit: 1s | Memory Limit: 256 MB
(Python on oj.vietnamson.com: 2s)
In mathematics, the Fibonacci numbers are the numbers in the following integer sequence, called the Fibonacci sequence, and characterized by the fact that every number after the first two is the sum of the two preceding ones. The sequence $F_n$ of Fibonacci numbers is defined by the recurrence relation: $F_n = F_{n-1} + F_{n-2}$
Some first element of Fibonacci sequence are: 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, …
Your task is to write program to find the nth Fibonacci number and return it raised to the power of n.
Example: n = 3, the output should be result = 8. (Third Fibonacci number is 2 and $2^3 = 8$)
Input
The input contains a positive integer n $(1 \le n \le 25)$.
Output
You should print one single number: the nth Fibonacci raised to the power of n.
Note (VIETNAMSON)
- Problem of the 2017 ACM-ICPC Vietnam Central Provincial Programming Contest (hosted by University of Science and Technology - The University of Danang). The statement and samples are kept verbatim from the original PDF. There are no official test data; the tests on oj.vietnamson.com were made by VIETNAMSON and checked against an independent brute-force solution (the original prints the samples in one table; here they are split).
- $F_1 = F_2 = 1$. The answer can have more than 100 digits ($F_{25}^{25} = 75025^{25}$).
- The original PDF does not state time/memory limits; oj.vietnamson.com uses the limits above.
- Python on oj.vietnamson.com: time limit 2 s, memory limit 1 GB.
Input
3
Output
8Input
4
Output
81Ý tưởng và lời giải chi tiết
Phần phân tích ý tưởng, các cách giải từ cơ bản đến tối ưu kèm code C++/Python và chấm thử trên VIETNAMSON OJ dành cho học viên đã đăng ký gói.
- Không biết học gì trước, học gì sau, học lan man nên kiến thức bị hổng.
- Bí bài không ai gỡ, ngồi cả buổi vẫn không ra rồi bỏ cuộc.
- Code chạy được nhưng không đủ điểm, không biết sai ở đâu, chậm ở đâu.
- Không có đề thi thử và người chấm, nên không biết mình đang ở mức nào.
- Dễ nản giữa chừng khi không có ai theo sát.
- Lộ trình 111 buổi video sắp sẵn từ dòng code đầu tiên đến đề HSG thật của các tỉnh.
- Thầy trực tiếp gỡ bí, chữa bài cho từng em qua nhóm Zalo riêng.
- Hệ thống chấm bài tự động 24/7 và thi thử HSG hằng tuần để biết chính xác mình đang ở đâu.
- Đóng học phí một lần, thầy kèm lâu dài: từ thi chuyên Tin đến HSG quốc gia và cả khi lên đại học.
