結果
| 問題 | No.2271 平方根の13桁精度近似計算 |
| コンテスト | |
| ユーザー |
chro_96
|
| 提出日時 | 2023-04-14 23:13:30 |
| 言語 | C(gnu17) (gcc 15.2.0) |
| 結果 |
AC
|
| 実行時間 | 1,588 ms / 2,000 ms |
| + 858µs | |
| コード長 | 563 bytes |
| 記録 | |
| コンパイル時間 | 60 ms |
| コンパイル使用メモリ | 37,120 KB |
| 実行使用メモリ | 5,888 KB |
| 最終ジャッジ日時 | 2026-07-23 07:35:14 |
| 合計ジャッジ時間 | 14,537 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 40 |
ソースコード
#include <stdio.h>
int main () {
long long n = 0LL;
int e = 0;
int res = 0;
long long ans = -1LL;
long long d = 1LL;
long long tmp = 0LL;
res = scanf("%lld", &n);
res = scanf("%d", &e);
while (e > 0) {
d *= 5LL;
e--;
}
if (n > 0LL) {
n %= d;
} else {
n = (d-(-n)%d)%d;
}
while (ans < 0LL && tmp < d && tmp <= (1LL<<29LL)) {
if ((tmp*tmp)%d == n) {
ans = tmp;
}
tmp += 1LL;
}
if (ans < 0LL) {
printf("NaN\n");
} else {
printf("%lld\n", ans);
}
return 0;
}
chro_96