結果

問題 No.8054 ほぼ直角二等辺三角形
ユーザー bal4u
提出日時 2019-05-14 08:35:24
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 487 bytes
コンパイル時間 308 ms
コンパイル使用メモリ 28,800 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-18 05:36:27
合計ジャッジ時間 1,750 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

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