欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 编程资源 > 编程问答 >内容正文

编程问答

One Card Poker——AtCoder - abc054_a

发布时间:2024/1/8 编程问答 36 豆豆
生活随笔 收集整理的这篇文章主要介绍了 One Card Poker——AtCoder - abc054_a 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

题目

Problem Statement

Alice and Bob are playing One Card Poker.
One Card Poker is a two-player game using playing cards.

Each card in this game shows an integer between 1 and 13, inclusive.
The strength of a card is determined by the number written on it, as follows:

Weak 2 << 3 << 4 << 5 << 6 << 7 << 8 << 9 << 10 << 11 << 12 << 13 << 1 Strong

One Card Poker is played as follows:

  • Each player picks one card from the deck. The chosen card becomes the player's hand.
  • The players reveal their hands to each other. The player with the stronger card wins the game.
    If their cards are equally strong, the game is drawn.
  • You are watching Alice and Bob playing the game, and can see their hands.
    The number written on Alice's card is AA, and the number written on Bob's card is BB.
    Write a program to determine the outcome of the game.

    要求

    • 1≦A≦13
    • 1≦B≦131≦B≦13
    • AA and BB are integers.
    • 输入
    • The input is given from Standard Input in the following format:

      AA BB
    • 输出
    • Print Alice if Alice will win. Print Bob if Bob will win. Print Draw if the game will be drawn.
    • 样例
    • InputcopyOutputcopy
      8 6 Alice

      8 is written on Alice's card, and 6 is written on Bob's card. Alice has the stronger card, and thus the output should be Alice.

    • 代码

    • #include<iostream>

    • using namespace std;

    •  int n,m;
      int main(){
      cin>>n>>m ;
          if(n==1){
          n=n+13;    
                     } 
               if(m==1){
               m=m+13;    
                         } 
          if(n>m){
                cout<<"Alice"<<endl;    
             }else if(n==m){
                  cout<<"Draw"<<endl;    
                }else if(n<m) {
                     cout<<"Bob"<<endl;    
                }

    • return 0;
      }

    • //有点乱,望见谅。

    总结

    以上是生活随笔为你收集整理的One Card Poker——AtCoder - abc054_a的全部内容,希望文章能够帮你解决所遇到的问题。

    如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。