結果

問題 No.1593 Perfect Distance
ユーザー kyawa
提出日時 2021-12-12 15:37:27
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 341 bytes
コンパイル時間 1,862 ms
コンパイル使用メモリ 192,952 KB
最終ジャッジ日時 2025-01-26 09:14:37
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

int main(){
    long res = 0;
    long N; cin >> N;
    long x = 1, y = N;
    while(x < N and y > 0){
        if(x * x + y * y < N * N) x++;
        if(x * x + y * y > N * N) y--;
        if(x * x + y * y == N * N){
            x++;
            res++;
        }
    }
    cout << res << '\n';
}
0