結果
| 問題 |
No.152 貯金箱の消失
|
| コンテスト | |
| ユーザー |
kou6839
|
| 提出日時 | 2015-02-24 18:37:59 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 222 ms / 5,000 ms |
| コード長 | 473 bytes |
| コンパイル時間 | 2,312 ms |
| コンパイル使用メモリ | 74,436 KB |
| 実行使用メモリ | 54,436 KB |
| 最終ジャッジ日時 | 2024-06-23 22:58:29 |
| 合計ジャッジ時間 | 4,594 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 12 |
ソースコード
import java.math.*;
import java.util.*;
class Main {
static int gcd(int a,int b){
if(b==0) return a;
else return gcd(b, a%b);
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int ans=0;
for(int i=1;i*i<n/4;i++){
for(int j=i+1;j*j<=n/4;j++){
if(gcd(j, i)!=1)continue;
if((j-i)%2==0) continue;
if( (j*j-i*i)+2*i*j+(j*j+i*i)>n/4) continue;
ans++;
}
}
System.out.println(ans);
}
}
kou6839