
博弈
yueqiq
这个作者很懒,什么都没留下…
展开
-
博弈问题及SG函数(真的真的非常灰常经典)!
博弈问题 若你想仔细学习博弈论,我强烈推荐加利福尼亚大学的Thomas S. Ferguson教授精心撰写并免费提供的这份教材,它使我受益太多。(如果你的英文水平不足以阅读它,我只能说,恐怕你还没到需要看“博弈论”的时候。) Nim游戏是博弈论中最经典的模型(之一?),它又有着十分简单的规则和无比优美的结论,由这个游戏开始了解博弈论恐怕是最合适不过了。 Nim游戏是组合游戏(转载 2012-05-27 14:09:58 · 475 阅读 · 0 评论 -
hdu1848 Fibonacci again and again
思路:求1000以内的每个数的sg值,最后异或为0则先手必败,否则先手输 因为m,n,p都小于1000,所以只要求前15个斐波那契数就可以了 ,打表解决; #include #include #include #include #include #include using namespace std; int fb[]={1,2,3,5,8,13,21,34,55,89,原创 2012-05-27 14:10:53 · 279 阅读 · 0 评论 -
Hdu1846 Brave Game && Hdu2188 悼念512汶川大地震遇难同胞——选拔志愿者
基本的巴什博弈问题。 1846 code: #include using namespace std; int n,m; int main() { int cas; cin>>cas; while(cas--) { cin>>n>>m; if(n%(m+1)) cout<<"first"<<endl;原创 2012-11-07 18:37:32 · 498 阅读 · 0 评论 -
hdu1850 Being a Good Boy in Spring Festival
Nim博弈问题,因为Nim博弈第一步要转化至必败态 设 s=a1 ^ a2 ^ a3 ^ a4 ^ ...... an,那么只需要把 ak 换为 ak^s 即可,当然 前者必须要大 因为 s=a1 ^ a2 ^ a3 ^ a4 ^ ak ^ s ^ .......an=a1^a2^a3^......an ^ s = s^s=0; 所以转为了必败态 code: #include #i原创 2012-11-12 16:26:07 · 420 阅读 · 0 评论 -
Hdu1847 Good Luck in CET-4 Everybody!
笨方法打了sg值表,A了之后把Sg值打印出来一看,发现自己NC了,sg值只有0 ,1,2.................. code: #include #include #include #include #include using namespace std; int sg[1001]; int num[]={10,1,2,4,8,16,32,64,128,256,512原创 2012-11-12 15:28:08 · 540 阅读 · 0 评论