結果
| 問題 | No.2271 平方根の13桁精度近似計算 |
| コンテスト | |
| ユーザー |
chro_96
|
| 提出日時 | 2023-04-14 23:13:30 |
| 言語 | C(gnu17) (gcc 15.2.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 563 bytes |
| 記録 | |
| コンパイル時間 | 284 ms |
| コンパイル使用メモリ | 38,832 KB |
| 最終ジャッジ日時 | 2026-02-22 10:26:09 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 12 TLE * 1 -- * 27 |
ソースコード
#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