結果

問題 No.328 きれいな連立方程式
ユーザー koyumeishikoyumeishi
提出日時 2015-12-21 11:28:12
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 727 bytes
コンパイル時間 932 ms
コンパイル使用メモリ 61,736 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-18 21:59:12
合計ジャッジ時間 2,761 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 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 1 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 1 ms
4,348 KB
testcase_11 AC 1 ms
4,348 KB
testcase_12 AC 1 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 1 ms
4,348 KB
testcase_20 AC 2 ms
4,348 KB
testcase_21 AC 2 ms
4,348 KB
testcase_22 AC 1 ms
4,348 KB
testcase_23 AC 1 ms
4,348 KB
testcase_24 AC 1 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 1 ms
4,348 KB
testcase_29 AC 2 ms
4,348 KB
testcase_30 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <vector>
#include <cstdio>
#include <algorithm>
#include <iostream>
using namespace std;

// http://www.wolframalpha.com/input/?i=solve[+c1%3Dp1%2Bp2%2C++c2%3Dp1*z1%2Bp2*z2%2C++c3%3Dp1*z1^2%2Bp2z2^2%2C++c4%3Dp1*z1^3%2Bp2*z2^3]

long long pow_(long long x, long long y){
	if(x==0) return 0;
	long long ret = 1;
	while(y){
		if(y&1) ret *= x;
		x *= x;
		y >>= 1;
	}
	return ret;
}

int main(){
	vector<long long> c(4);
	for(auto& v: c) cin >> v;
	long long a = pow_(c[0],2) * pow_(c[3],2) - 6*c[0]*c[1]*c[2]*c[3] + 4*c[0]*pow_(c[2],3) + 4*pow_(c[1],3)*c[3] - 3*pow_(c[1],2)*pow_(c[2],2);
	if(a>0){
		puts("R");
		return 0;
	}
	a = c[0]*c[2] - pow_(c[1],2);
	if(a>0){
		puts("R");
		return 0;
	}
	puts("I");
	return 0;
}
0