『杭電1848』Fibonacci again and again
Problem Description
任何一個大學生對菲波那契數列(Fibonacci numbers)應該都不會陌生,它是這樣定義的:
F(1)=1;
F(2)=2;
F(n)=F(n-1)+F(n-2)(n>=3);
所以,1,2,3,5,8,13……就是菲波那契數列。
在HDOJ上有不少相關的題目,比如1005 Fibonacci again就是曾經的浙江省賽題。
今天,又一個關於Fibonacci的題目出現了,它是一個小遊戲,定義如下:
1、 這是一個二人遊戲;
2、 一共有3堆石子,數量分別是m, n, p個;
3、 兩人輪流走;
4、 每走一步可以選擇任意一堆石子,然後取走f個;
5、 f只能是菲波那契數列中的元素(即每次只能取1,2,3,5,8…等數量);
6、 最先取光所有石子的人為勝者;
假設雙方都使用最優策略,請判斷先手的人會贏還是後手的人會贏。
Input
輸入資料包含多個測試用例,每個測試用例佔一行,包含3個整數m,n,p(1<=m,n,p<=1000)。
m=n=p=0則表示輸入結束。
Output</
相關文章
- HDU 1848 Fibonacci again and again(SG函式)AI函式
- HDU 1848 Fibonacci again and again (尼姆博弈+sg函式)AI函式
- NYOJ 480 Fibonacci Again!AI
- ASSM AgainSSMAI
- On MySQL replication, again…MySqlAI
- If I were a boy againAI
- Decade counter againAI
- Trees and XOR Queries AgainAI
- Again, a chinese char conversion problemAI
- WEEK5|WEB Unserialize AgainWebAI
- Use of Indexes Against Views (179)IndexAIView
- HDU - 1702 - ACboy needs your help again!AI
- Please set RAT_ELRACKTYPE and try againAI
- Codeforces 582 B Once Again... (LIS)AI
- ORA-01555 say u againAI
- 藍橋嵌入式之 USART_AgainAI
- What can men do against such reckless hate?AI
- save the status of schema and gather all stat of schemas again.AI
- postfix日誌中出現“Hostnotfound,tryagain”(轉)AI
- LightOJ 1038 Race to 1 Again (簡單期望)AI
- Introduction to pinatrace annotate version 2: a look into latches againAI
- hdu 1789 Doing Homework again(簡單貪心)AI
- (UVA - 10976)Fractions Again?!(技巧,暴力列舉)FractionAI
- ZOJ 3802 Easy 2048 Again(狀壓dp)AI
- The client is currently locked against logon.clientAIGo
- 矽基流動 The parameter is invalid. Please check againAI
- $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithOracleAI
- CF1982F Sorting Problem Again 題解AI
- 解決:ChatGPT too many requests in 1 hour.Try again laterChatGPTAI
- [轉載]SystemD strikes again : Unit X.mount is bound to inactive unitAI
- HDU1788Chinese remainder theorem again(中國剩餘定理 簡單)REMAI
- back button history handling for iframe with jquery (IE failed me again)jQueryAI
- Thinking again in C++(二)自賦值是非公斷 (轉)ThinkingAIC++賦值
- hud--4251The Famous ICPC Team Again+劃分樹入門題AI
- 璧合在京釋出自助開放式廣告投放平臺AGAINAI
- 杭電多校補題
- would dispatch back to the current handler URL [/doLogin] again. Check your ViewResolver setup!AIView
- 互動類敘事遊戲《再見 Once Again》預計夏天上線遊戲AI