题目:HDU 5978 To begin or not to begin
Ideas:
- Title means that: given n black ball, a red ball, red ball to get people to victory. If the upper hand advantage of the output 1, output 2 is no advantage, equality of opportunity and outputs 0.
- Several former probability can be hand counted, and then find the law. Or directly bold guess is odd 0, an even number.
Code:
1 #include <cstdio> 2 #include <cstring> 3 #include <iostream> 4 #include <sstream> 5 #include <cmath> 6 #include <algorithm> 7 #include <string> 8 #include <stack> 9 #include <queue> 10 #include <vector> 11 #include <map> 12 using namespace std; 13 14 int main() 15 { 16 int k; 17 while(~scanf("%d", &k)) 18 { 19 if(k % 2 == 0) 20 printf("1\n"); 21 else 22 printf("0\n"); 23 } 24 return 0; 25 }