結果

問題 No.1624 三角形の反射
ユーザー milanis48663220
提出日時 2021-07-23 22:04:14
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 1,236 bytes
コンパイル時間 1,061 ms
コンパイル使用メモリ 112,356 KB
最終ジャッジ日時 2025-01-23 08:01:45
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <cmath>
#include <numeric>
#include <functional>
#include <cassert>

#define debug_value(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << #x << "=" << x << endl;
#define debug(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << x << endl;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using namespace std;
typedef long long ll;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    double A; cin >> A;
    int b = A*1000+0.01;
    int a = 1000;
    int g = gcd(a, b);
    a /= g;
    b /= g;
    // cout << a << ' ' << b << endl;
    char ans;
    if(b%2 == 0){
        if(a%2 == 0) ans = 'A';
        else ans = 'B';
    }else{
        if(a%2 == 0) ans = 'C';
        else ans = 'A';
    }
    int cnt = 0;
    if(a == b){
        cnt = 1;
    }else{
        if(a < b) swap(a, b);
        cnt = a+b-2+(a+b)/2+(a-b)/2;
    }
    cout << (char)ans << ' ' << cnt << endl;
}
0