結果

問題 No.328 きれいな連立方程式
ユーザー NekosyndromeNekosyndrome
提出日時 2015-12-21 00:48:56
言語 C++11
(gcc 11.4.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,160 bytes
コンパイル時間 1,451 ms
コンパイル使用メモリ 161,276 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-18 00:07:50
合計ジャッジ時間 2,521 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 1 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 1 ms
4,348 KB
testcase_14 AC 1 ms
4,348 KB
testcase_15 AC 1 ms
4,348 KB
testcase_16 AC 1 ms
4,348 KB
testcase_17 AC 1 ms
4,348 KB
testcase_18 AC 2 ms
4,348 KB
testcase_19 AC 2 ms
4,348 KB
testcase_20 AC 1 ms
4,348 KB
testcase_21 AC 2 ms
4,348 KB
testcase_22 AC 2 ms
4,348 KB
testcase_23 AC 1 ms
4,348 KB
testcase_24 AC 2 ms
4,348 KB
testcase_25 AC 2 ms
4,348 KB
testcase_26 AC 2 ms
4,348 KB
testcase_27 AC 1 ms
4,348 KB
testcase_28 AC 2 ms
4,348 KB
testcase_29 AC 2 ms
4,348 KB
testcase_30 AC 1 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define REP(x,y,z) for(int x=y;x<=z;x++)
#define FORD(x,y,z) for(int x=y;x>=z;x--)
#define MSET(x,y) memset(x,y,sizeof(x))
#define FOR(x,y) for(__typeof(y.begin()) x=y.begin();x!=y.end();x++)
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define SZ size()
#define M 
void RI(){}
template<typename... T>
void RI( int& head, T&... tail ) {
    scanf("%d",&head);
    RI(tail...);
}
using namespace std;
typedef long long LL;
typedef complex<double> C;
int c1,c2,c3,c4;
double z1z2,p,a,b,b2;
bool eq(double x,double y)
{
	return fabs(x-y) < 1e-8;
}
bool check()
{
	if(c1==0) return false;
	
	p = c1/2.0;
	a = c2/2.0/p;
	b2 = z1z2 - a*a;
	if(b2<0) return false;
	b = sqrt(b2);

	////
	C z1 = C(a, b);
	C z2 = C(a, -b);
	C tmp;

	tmp = p*(z1*z1 + z2*z2);
	if( !eq(real(tmp), c3) ) return false;
	if( !eq(imag(tmp), 0) ) return false;

	tmp = p*(z1*z1*z1 + z2*z2*z2);
	if( !eq(real(tmp), c4) ) return false;
	if( !eq(imag(tmp), 0) ) return false;

	return true;
}
int main()
{
	while(~scanf("%d %d %d %d",&c1,&c2,&c3,&c4))
	{
		z1z2 = c2*c4-c3*c3;
		z1z2 /= c1*c3-c2*c2;

		puts(check()?"I":"R");
	}
	return 0;
}
0