結果
| 問題 |
No.2271 平方根の13桁精度近似計算
|
| コンテスト | |
| ユーザー |
chro_96
|
| 提出日時 | 2023-04-14 23:13:30 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 563 bytes |
| コンパイル時間 | 489 ms |
| コンパイル使用メモリ | 29,440 KB |
| 実行使用メモリ | 10,496 KB |
| 最終ジャッジ日時 | 2024-10-10 14:18:51 |
| 合計ジャッジ時間 | 6,616 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / 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