結果

問題 No.1593 Perfect Distance
ユーザー kotatsugamekotatsugame
提出日時 2021-07-09 21:57:40
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 312 bytes
コンパイル時間 481 ms
コンパイル使用メモリ 65,264 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-14 08:55:35
合計ジャッジ時間 1,512 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 4 ms
4,376 KB
testcase_11 AC 6 ms
4,380 KB
testcase_12 AC 9 ms
4,380 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:15:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
   15 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
using namespace std;
long N;
long isq(long A)
{
	long L=0,R=A+1;
	while(R-L>1)
	{
		long M=L+R>>1;
		if(M*M<=A)L=M;
		else R=M;
	}
	return L;
}
main()
{
	cin>>N;
	long ans=0;
	for(long x=1;x<N;x++)
	{
		long y2=N*N-x*x;
		long y=isq(y2);
		if(y*y==y2)
		{
			ans++;
		}
	}
	cout<<ans<<endl;
}
0