結果

問題 No.1274 楽しい格子点
ユーザー tailstails
提出日時 2020-10-30 22:22:52
言語 Perl
(5.38.2)
結果
WA  
実行時間 -
コード長 441 bytes
コンパイル時間 391 ms
コンパイル使用メモリ 5,332 KB
実行使用メモリ 5,704 KB
最終ジャッジ日時 2023-09-29 06:49:43
合計ジャッジ時間 3,039 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 7 ms
5,696 KB
testcase_01 AC 6 ms
5,508 KB
testcase_02 AC 7 ms
5,436 KB
testcase_03 AC 6 ms
5,496 KB
testcase_04 AC 7 ms
5,432 KB
testcase_05 AC 7 ms
5,664 KB
testcase_06 AC 6 ms
5,540 KB
testcase_07 AC 6 ms
5,388 KB
testcase_08 AC 6 ms
5,680 KB
testcase_09 AC 6 ms
5,412 KB
testcase_10 AC 7 ms
5,560 KB
testcase_11 AC 6 ms
5,540 KB
testcase_12 AC 6 ms
5,468 KB
testcase_13 AC 6 ms
5,460 KB
testcase_14 AC 7 ms
5,404 KB
testcase_15 AC 7 ms
5,616 KB
testcase_16 AC 7 ms
5,412 KB
testcase_17 AC 6 ms
5,460 KB
testcase_18 AC 6 ms
5,660 KB
testcase_19 AC 6 ms
5,404 KB
testcase_20 AC 7 ms
5,504 KB
testcase_21 AC 6 ms
5,664 KB
testcase_22 AC 6 ms
5,380 KB
testcase_23 AC 6 ms
5,508 KB
testcase_24 AC 6 ms
5,408 KB
testcase_25 AC 6 ms
5,452 KB
testcase_26 AC 7 ms
5,500 KB
testcase_27 AC 7 ms
5,704 KB
testcase_28 AC 6 ms
5,564 KB
testcase_29 AC 7 ms
5,672 KB
testcase_30 AC 6 ms
5,528 KB
testcase_31 AC 6 ms
5,564 KB
testcase_32 AC 6 ms
5,432 KB
testcase_33 AC 6 ms
5,496 KB
testcase_34 AC 6 ms
5,432 KB
testcase_35 AC 7 ms
5,428 KB
testcase_36 AC 6 ms
5,408 KB
testcase_37 AC 6 ms
5,428 KB
testcase_38 AC 6 ms
5,556 KB
testcase_39 AC 6 ms
5,564 KB
testcase_40 AC 6 ms
5,428 KB
testcase_41 AC 7 ms
5,508 KB
testcase_42 AC 6 ms
5,408 KB
testcase_43 AC 6 ms
5,500 KB
testcase_44 AC 6 ms
5,496 KB
testcase_45 AC 7 ms
5,360 KB
testcase_46 AC 6 ms
5,636 KB
testcase_47 AC 6 ms
5,504 KB
testcase_48 AC 6 ms
5,564 KB
testcase_49 AC 6 ms
5,408 KB
testcase_50 AC 6 ms
5,412 KB
testcase_51 AC 6 ms
5,404 KB
testcase_52 AC 6 ms
5,220 KB
testcase_53 WA -
testcase_54 AC 7 ms
5,432 KB
testcase_55 WA -
testcase_56 AC 7 ms
5,408 KB
testcase_57 AC 6 ms
5,576 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

use integer;

sub gcd{my($u,$v)=@_;($u,$v)=($v,$u%$v)while$v;$u}

($a,$b)=map abs,glob<>;
if($a==0&&$b==0){
	no integer;
	print 1/4;
	exit;
}
if($a==0){
	$a=$b;
	$b=0;
}
if($b==0){
	for($i=1;$i<20;$i+=$a){
		no integer;
		$z+=($i+1)**-($i+1);
	}
	print $z;
	exit;
}

$g=gcd($a,$b);
$o=$a/$g&$b/$g&1;
for($i=1;$i<20;$i+=$g){
	for($j=1;$j<20;$j+=$g){
		if($o?!(($i/$g^$j/$g)&1):1){
			no integer;
			$z+=($i+$j)**-($i+$j);
		}
	}
}
print $z;

0