結果
| 問題 |
No.152 貯金箱の消失
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-05-02 02:24:18 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 161 ms / 5,000 ms |
| コード長 | 853 bytes |
| コンパイル時間 | 1,870 ms |
| コンパイル使用メモリ | 76,872 KB |
| 実行使用メモリ | 54,160 KB |
| 最終ジャッジ日時 | 2024-10-05 01:50:00 |
| 合計ジャッジ時間 | 4,022 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 12 |
ソースコード
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;
bi:for(int i=1;;i++){
for(int j=i+1;;j++){
long gcd=GCD(i,j);
if(gcd!=1)continue;
if(j%2==1&&i%2==1)continue;
if(2*i*j+2*j*j>l){
if(j==i+1)break bi;
else break;
}
// System.out.println(2*i*j+" "+(j*j-i*i)+" "+(2*i*j)*(2*i*j)+(j*j-i*i)*(j*j-i*i));
count++;
count%=mod;
}
}
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);
}
}