結果
| 問題 | No.1593 Perfect Distance | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2021-07-09 22:43:54 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 5 ms / 2,000 ms | 
| コード長 | 306 bytes | 
| コンパイル時間 | 974 ms | 
| コンパイル使用メモリ | 78,836 KB | 
| 最終ジャッジ日時 | 2025-01-22 22:21:35 | 
| ジャッジサーバーID (参考情報) | judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 17 | 
ソースコード
#include<iostream>
#include<cmath>
using namespace std;
int main() {
    long n;
    cin >> n;
  	long ans = 0;
  	for (long i = 1; i < 500000; i++) {
  	    long x = n*n-i*i;
  	    if (x > 0 && floor(sqrt(x))*floor(sqrt(x)) == x) {
  	        ans++;
  	    }
  	}
    cout << ans << endl;
    return 0;
}
            
            
            
        