QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#138637#5253. DenormalizationUNos_maricones#WA 1ms3636kbC++201.0kb2023-08-12 04:59:592023-08-12 05:00:03

Judging History

你现在查看的是最新测评结果

  • [2023-08-12 05:00:03]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3636kb
  • [2023-08-12 04:59:59]
  • 提交

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;
};

Details

Tip: Click on the bar to expand more detailed information

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