結果
問題 | No.1593 Perfect Distance |
ユーザー |
|
提出日時 | 2021-07-09 23:05:52 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 125 ms / 2,000 ms |
コード長 | 312 bytes |
コンパイル時間 | 617 ms |
コンパイル使用メモリ | 64,592 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-01 18:10:58 |
合計ジャッジ時間 | 1,768 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
コンパイルメッセージ
main.cpp:15:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 15 | main() | ^~~~
ソースコード
#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<=A/M)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;}