QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#138637 | #5253. Denormalization | UNos_maricones# | WA | 1ms | 3636kb | C++20 | 1.0kb | 2023-08-12 04:59:59 | 2023-08-12 05:00:03 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long double lf;
const int MX = 10'000;
const lf EPS = 1e-6;
bool round_integer( const lf &x )
{
long long y = (long long) ( x + 0.5L );
return fabs( x - y ) < EPS;
}
int main()
{
int n;
scanf("%d", &n );
vector< lf > x( n );
for( auto &ref : x )
scanf("%Lf", &ref );
for( int r0 = 1; r0 <= MX; ++r0 )
{
const lf d = 1.0L * r0 / x[0];
long long sum2 = r0 * r0;
long long g = r0;
vector< int > v = { r0 };
for( int i = 1; i < n; ++ i )
{
const lf ri = d * x[i];
if( round_integer( ri ) )
{
const long long rii = (long long) ( ri + 0.5L );
if( 1 <= rii && rii <= MX )
{
g = __gcd( g, rii );
v.push_back( rii );
sum2 += rii * rii;
}
else
g = -1;
}
else
{
g = -1;
break;
}
}
if( fabsl( d * d - sum2 ) < EPS && g == 1 )
{
for( auto &r : v )
printf("%d\n", r );
return 0;
}
}
return 0;
};
詳細信息
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3636kb
input:
2 0.909840249060 0.414958698174
output:
result:
wrong output format Unexpected end of file - int32 expected