結果

問題 No.356 円周上を回る3つの動点の一致
ユーザー IDID
提出日時 2016-04-02 00:03:18
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,890 bytes
コンパイル時間 888 ms
コンパイル使用メモリ 79,248 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-10 08:28:44
合計ジャッジ時間 5,143 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 1 ms
6,944 KB
testcase_11 AC 2 ms
6,944 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 826 ms
6,940 KB
testcase_15 AC 2 ms
6,940 KB
testcase_16 WA -
testcase_17 AC 105 ms
6,944 KB
testcase_18 AC 2 ms
6,940 KB
testcase_19 WA -
testcase_20 AC 3 ms
6,940 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 61 ms
6,944 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 21 ms
6,940 KB
testcase_32 AC 22 ms
6,940 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 2 ms
6,940 KB
testcase_38 AC 22 ms
6,940 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 34 ms
6,940 KB
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 AC 1 ms
6,940 KB
testcase_48 AC 2 ms
6,940 KB
testcase_49 WA -
testcase_50 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <ostream>
#include <queue>
#include <stack>
#include <string>
#include <vector>
#define INF 1000000000
#define rep(i,a,b) for (int i=(a);i<(b);i++)
#define rev(i,a,b) for (int i=(a)-1;i>=b;i--)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef queue<int> qi;
typedef vector<int> vi;
typedef vector<string> vs;
int dx[4] = { 0, 1, 0, -1 };
int dy[4] = { 1, 0, -1, 0 };

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	int a,b,c;
	cin >> a >> b >> c;
	int tmpa = a, tmpb = b, tmpc = c;
	vi n;
	int w = 2;
	while(1) {
		int a1 = tmpa%w;
		int b1 = tmpb%w;
		int c1 = tmpc%w;
		if(a1 == 0 && b1==0 && c1==0) {
			n.push_back(w);
			tmpa /= w;
			tmpb /= w;
			tmpc /= w;
			w = 2;
		} else if(a1 == 0 && b1==0) {
			n.push_back(w);
			tmpa /= w;
			tmpb /= w;
			w = 2;
		} else if(a1 == 0 && c1==0) {
			n.push_back(w);
			tmpa /= w;
			tmpc /= w;
			w = 2;
		} else if(b1 == 0 && c1==0) {
			n.push_back(w);
			tmpc /= w;
			tmpb /= w;
			w = 2;
		} else {
			w++;
		}
		if(w > tmpa && w> tmpb && w > tmpc) break;
	}

	int lcm = 1;
	rep(i,0,n.size()) lcm *= n[i];
	lcm *= tmpa;
	lcm *= tmpb;
	lcm *= tmpc;

	double aa = (double)lcm/a, bb = (double)lcm/b, cc = (double)lcm/c;
	int num = 2, ans2 = 1;
	while(aa / num > 1) {
		double tmp1 = aa / num, tmp2 = bb / num, tmp3 = cc / num;
		tmp1 -= (int)tmp1;
		tmp2 -= (int)tmp2;
		tmp3 -= (int)tmp3;
		tmp1 = floor(tmp1*10000) / 10000;
		tmp2 = floor(tmp2*10000) / 10000;
		tmp3 = floor(tmp3*10000) / 10000;
		// printf("%.20f %.20f %.20f\n", tmp1, tmp2, tmp3);
		// cout << tmp1 << " " << tmp2 << " " << tmp3 << endl;
		if(tmp1 == tmp2 && tmp1 == tmp3) ans2 = num;
		num++;
	}

	cout <<	lcm << "/" << ans2 << endl;

	return 0;
}
0