zoukankan      html  css  js  c++  java
  • Codeforce 513A

    Two players play a simple game. Each player is provided with a box with balls. First player's box contains exactly n1 balls and second player's box contains exactly n2 balls. In one move first player can take from 1 to k1 balls from his box and throw them away. Similarly, the second player can take from 1 to k2 balls from his box in his move. Players alternate turns and the first player starts the game. The one who can't make a move loses. Your task is to determine who wins if both players play optimally.

    Input

    The first line contains four integers n1, n2, k1, k2. All numbers in the input are from 1 to 50.

    This problem doesn't have subproblems. You will get 3 points for the correct submission.

    Output

    Output "First" if the first player wins and "Second" otherwise.

    Examples
    input
    2 2 1 2
    output
    Second
    input
    2 1 1 1
    output
    First
    Note

    Consider the first sample test. Each player has a box with 2 balls. The first player draws a single ball from his box in one move and the second player can either take 1 or 2 balls from his box in one move. No matter how the first player acts, the second player can always win if he plays wisely.

     题解:每次都拿一个

     1 #include <iostream>
     2 #include <algorithm>
     3 #include <cstring>
     4 #include <cstdio>
     5 #include <vector>
     6 #include <cstdlib>
     7 #include <iomanip>
     8 #include <cmath>
     9 #include <ctime>
    10 #include <map>
    11 #include <set>
    12 using namespace std;
    13 #define lowbit(x) (x&(-x))
    14 #define max(x,y) (x>y?x:y)
    15 #define min(x,y) (x<y?x:y)
    16 #define MAX 100000000000000000
    17 #define MOD 1000000007
    18 #define pi acos(-1.0)
    19 #define ei exp(1)
    20 #define PI 3.141592653589793238462
    21 #define INF 0x3f3f3f3f3f
    22 #define mem(a) (memset(a,0,sizeof(a)))
    23 typedef long long ll;
    24 const int N=1005;
    25 const int mod=1e9+7;
    26 int main()
    27 {
    28 //    std::ios::sync_with_stdio(false);
    29     int n1,n2,k1,k2;
    30     cin>>n1>>n2>>k1>>k2;
    31     if(n1<=n2) cout<<"Second"<<endl;
    32     else if(n1>n2) cout<<"First"<<endl;
    33     return 0;
    34 }
  • 相关阅读:
    颜色转换
    颜色转换、随机、16进制转换、HSV
    ColorTransform调整显示对象的颜色值
    unity+统计代码总行数
    Unity加载json数据
    打不开unity编辑器界面,每次默认打开上一次项目,并且报错Error loading file:///C%3A%2FUsers%2FT01017%2FAppData%2FRoaming%2FUnity%2FPackages%2Fnode_modules%2F
    Unity 同一Text文本修改不同的字体大小和字体颜色,加空格
    Unity 限时使用 限制试用时间和使用次数
    unity更改文字透明度
    unity+动画状态机
  • 原文地址:https://www.cnblogs.com/wydxry/p/7262232.html
Copyright © 2011-2022 走看看