結果

問題 No.152 貯金箱の消失
ユーザー 37zigen37zigen
提出日時 2016-05-02 00:27:53
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 733 bytes
コンパイル時間 2,985 ms
コンパイル使用メモリ 77,664 KB
実行使用メモリ 61,472 KB
最終ジャッジ日時 2024-04-15 08:39:33
合計ジャッジ時間 9,953 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 140 ms
61,244 KB
testcase_01 AC 261 ms
41,260 KB
testcase_02 AC 144 ms
41,328 KB
testcase_03 AC 218 ms
41,408 KB
testcase_04 TLE -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;
import java.util.Scanner;
public class Main{
	public static void main(String[] args)throws Exception{
		new Main().solve();
	}
	int mod=1000003;
	void solve(){
		Scanner sc=new Scanner(System.in);
		int l=sc.nextInt();
		l=l/4;
		int count=0;
		for(int i=1;i<l/3;i++){
			for(int j=i;i+j<l;j++){
				long gcd=GCD(i,j);
				if(gcd!=1)continue;
				double a=Math.sqrt(i*i+j*j);
				if(a%1!=0)continue;
				if(a+i+j>l)continue;
				count++;
			}
		}
		System.out.println(count);
	}
	long LCM(long t1,long t2){
		long a=GCD(t1,t2);
		long tt1=t1/a;
		long tt2=t2/a;
		return tt1*tt2*a;
	}
	long GCD(long t1,long t2){
		if(t1<t2){
			long d=t2;
			t2=t1;
			t1=d;
		}
		if(t2==0)return t1;
		return GCD(t2,t1%t2);
	}
}
0