結果

問題 No.508 超ゆとり教育
ユーザー motimoti
提出日時 2018-05-20 19:00:34
言語 Perl
(5.38.2)
結果
AC  
実行時間 140 ms / 2,000 ms
コード長 266 bytes
コンパイル時間 229 ms
コンパイル使用メモリ 5,296 KB
実行使用メモリ 5,108 KB
最終ジャッジ日時 2023-09-11 00:07:26
合計ジャッジ時間 2,114 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 139 ms
4,820 KB
testcase_01 AC 140 ms
5,084 KB
testcase_02 AC 138 ms
5,108 KB
testcase_03 AC 139 ms
4,832 KB
testcase_04 AC 138 ms
5,064 KB
testcase_05 AC 139 ms
5,068 KB
testcase_06 AC 139 ms
4,820 KB
testcase_07 AC 138 ms
4,836 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

#!/usr/bin/env perl

use strict;
use warnings;

my $n = <>; chomp $n;
my $r = int(sqrt($n / 3));
for (my $d = -1000000; $d < 1000000; $d++) {
  if (abs(($r + $d) * ($r + $d) * 3 - $n) <= 1000000) {
    if ($r + $d > 0) {
      print $r + $d;
      exit;
    }
  }
}
0