結果

問題 No.1593 Perfect Distance
ユーザー You_sakuYou_saku
提出日時 2021-09-17 23:28:51
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 489 bytes
コンパイル時間 738 ms
コンパイル使用メモリ 90,560 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-29 22:17:31
合計ジャッジ時間 1,374 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<string>
#include<set>
#include<map>
#include<ios>
#include<iomanip> 
#include<cmath>
#include<limits>
#include<algorithm>

using namespace std;

int main(){
    long long n;
    cin >> n;
    long long count = 0;
    for(int i=1; i<=n-1; i++){
        long long tmp = n * n - 1LL * i * i;
        long long y = (long long)(sqrt(1.0 * tmp) + 1.0e-9);
        if (i * i + y * y == n *n)  count++; 
    }
    cout << count << endl;
    return 0;
}
0