結果

問題 No.8054 ほぼ直角二等辺三角形
コンテスト
ユーザー akakimidori
提出日時 2019-04-01 22:18:05
言語 C(gnu17)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=gnu17 -Wno-error=implicit-function-declaration -Wno-error=implicit-int -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 676 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 214 ms
コンパイル使用メモリ 41,872 KB
最終ジャッジ日時 2026-02-22 02:44:31
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>
#include<string.h>
#include<math.h>

typedef int32_t i32;
typedef int64_t i64;

#define MAX(a,b) ((a) > (b) ? (a) : (b))
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#define ABS(a) ((a) > (0) ? (a) : -(a))

void run (void) {
  i32 d;
  scanf ("%" SCNi32, &d);
  if (d == 1) {
    puts("3 4 5");
    return;
  }
  i64 m = 1;
  while (--d) {
    m *= 10;
  }
  i64 x = 1;
  i64 y = 1;
  while (y < m) {
    i64 nx = 3 * x + 4 * y;
    i64 ny = 2 * x + 3 * y;
    x = nx;
    y = ny;
  }
  printf ("%" PRIi64 " %" PRIi64 " %" PRIi64 "\n", x / 2, x / 2 + 1, y);
}

int main (void) {
  run ();
  return 0;
}
0