結果

問題 No.3054 ほぼ直角二等辺三角形
ユーザー bal4ubal4u
提出日時 2019-05-14 08:35:24
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 487 bytes
コンパイル時間 143 ms
コンパイル使用メモリ 28,304 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-25 06:41:37
合計ジャッジ時間 2,111 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

// yukicoder: 3054 ほぼ直角二等辺三角形
// 2019.5.14 bal4u

#include <stdio.h>

int main()
{
	int i, X;
	long long mi, a, a1, a2, c, c1, c2;
	
	scanf("%d", &X);
	mi = 1; for (i = 1; i < X; i++) mi *= 10;
	a2 = 3, a1 = 20, c2 = 5, c1 = 29;
	if (X == 1) a = a2, c = c2;
	else if (X == 2) a = a1, c = c1;
	else {
		a = 0;
		while (a < mi) {
			a = 6*a1 - a2 + 2;
			a2 = a1, a1 = a;
			c = 6*c1 - c2;
			c2 = c1, c1 = c;
		}
	}
	printf("%lld %lld %lld\n", a, a+1, c);
	return 0;
}
0