以下の内容はhttps://shiroyuki2020.hatenablog.com/entry/atcoder_abc054_aより取得しました。


AtCoder|ABC054:A - One Card Poker

AtCoderの過去問対策です。ABCで解けなかった問題、ためになった問題のコードを備忘録として残します。

問題

A - One Card Poker

解説

https://img.atcoder.jp/abc054/editorial.pdf

解答例

#include <bits/stdc++.h>
using namespace std;

int main() {
  int A, B;
  cin >> A >> B;
  
  // 1を14として扱う
  if(A == 1){
    A += 13;
  }
  if(B == 1){
    B += 13;
  }
  
  if(A > B){
    cout << "Alice" << endl;
  }else if(A < B){
    cout << "Bob" << endl;
  }else{
    cout << "Draw" << endl;
  }
}

メモ

  • 1を14として扱うと大小で判定できる




以上の内容はhttps://shiroyuki2020.hatenablog.com/entry/atcoder_abc054_aより取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14