結果

問題 No.1624 三角形の反射
ユーザー atjh16atjh16
提出日時 2021-09-07 20:30:00
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 403 bytes
コンパイル時間 1,571 ms
コンパイル使用メモリ 163,872 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-08-25 12:54:18
合計ジャッジ時間 2,741 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 1 ms
4,376 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 1 ms
4,376 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 2 ms
4,376 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 2 ms
4,380 KB
testcase_18 WA -
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 WA -
testcase_24 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

double a;
int n;

int gcd(int p, int q) {
	if (q == 0)
		return p;

	return gcd(q, p % q);
}

int main()
{
	cin >> a;

	a *= 1000;
	n = (int)a;
	
	int g = gcd(n, 1000);

	n /= g;
	int d = 1000 / g;

	if ((n + d) % 2 == 0)
		cout << "A ";
	else if (d % 2 == 1)
		cout << "B ";
	else
		cout << "C ";

	cout << n + d + max(n, d) - 3 + max(n, d) % 2 << endl;
}
0