結果
| 問題 | No.1624 三角形の反射 | 
| コンテスト | |
| ユーザー |  msm1993 | 
| 提出日時 | 2021-07-28 11:02:00 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 504 bytes | 
| コンパイル時間 | 1,564 ms | 
| コンパイル使用メモリ | 167,740 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-07-02 09:55:16 | 
| 合計ジャッジ時間 | 2,070 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 22 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b){
  if (b == 0){
    return a;
  } else {
    return gcd(b, a % b);
  }
}
int main(){
  string a;
  cin >> a;
  a.erase(a.end() - 4);
  int num = stoi(a);
  int den = 1000;
  int g = gcd(num, den);
  int y = num / g;
  int x = den / g;
  if ((x + y) % 2 == 0){
    cout << 'A';
  } else if (x % 2 == 1){
    cout << 'B';
  } else {
    cout << 'C';
  }
  cout << ' ';
  cout << (x - 1) + (y - 1) + (x + y) / 2 + abs(x - y) / 2 << endl;
}
            
            
            
        