結果
| 問題 | No.1593 Perfect Distance |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-07-10 00:14:26 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 605 bytes |
| 記録 | |
| コンパイル時間 | 902 ms |
| コンパイル使用メモリ | 75,464 KB |
| 最終ジャッジ日時 | 2025-01-22 23:08:22 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 17 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:36:25: warning: ‘ans’ may be used uninitialized [-Wmaybe-uninitialized]
36 | ++ans;
| ^~~~~
main.cpp:29:18: note: ‘ans’ was declared here
29 | ll x,y,n,ans;
| ^~~
ソースコード
#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
using ll = long long int;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);
#define l_ength size
void mul_mod(ll& a, ll b){
a *= b;
a %= MOD;
}
void add_mod(ll& a, ll b){
a = (a<MOD)?a:(a-MOD);
b = (b<MOD)?b:(b-MOD);
a += b;
a = (a<MOD)?a:(a-MOD);
}
int main(void){
ll x,y,n,ans;
std::cin >> n; y = n;
for(x=1ll; x<n; ++x){
while(y>0 && x*x+y*y>n*n){
--y;
}
if(x*x+y*y==n*n){
++ans;
}
}
std::cout << ans << std::endl;
return 0;
}