标签:
https://leetcode.com/problems/nim-game/
经典博弈,数学归纳法。
1 #include <iostream> 2 using namespace std; 3 4 class Solution { 5 public: 6 bool canWinNim(int n) { 7 return (n % 4 != 0); 8 } 9 }; 10 11 int main () 12 { 13 Solution testSolution; 14 bool result = false; 15 16 result = testSolution.canWinNim(1); 17 18 cout << result << endl; 19 20 char ch; 21 cin >> ch; 22 23 return 0; 24 }
标签:
原文地址:http://www.cnblogs.com/pegasus923/p/5499939.html