srupのメモ帳

競プロで解いた問題や勉強したことを記録していくメモ帳

yukicoder No.427 テレビ

問題

問題概要

与えられた数字が3:4なのか4:3なのかを判別する問題。

解法

最大公約数で割って、考えた。

ミス

4:3か3:4しかないから、大小だけみれば十分なのか。

コード

#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
const int INF = 1e9;

int main(void){
    int h, w; cin >> h >> w;
    int g = __gcd(h, w);
    h /= g; w /= g;
    if(h == 4 && w  == 3){
        printf("TATE\n");
    }else{
        printf("YOKO\n");
    }
    return 0;
}