結果
| 問題 | No.1593 Perfect Distance | 
| コンテスト | |
| ユーザー |  kuc_jackson | 
| 提出日時 | 2021-07-10 10:14:42 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 3 ms / 2,000 ms | 
| コード長 | 371 bytes | 
| コンパイル時間 | 2,065 ms | 
| コンパイル使用メモリ | 191,020 KB | 
| 最終ジャッジ日時 | 2025-01-22 23:52:52 | 
| ジャッジサーバーID (参考情報) | judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 17 | 
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
int main(){
    ll N; cin >> N;
    ll temp = N - 1, y = 1, ans = 0;
    N = N * N;
    for(ll x = temp; x > 0; x--){
        while(x * x + y * y < N)y++;
        if(x * x + y * y == N)ans++;
    }
    cout << ans << endl;
}
            
            
            
        