結果

問題 No.356 円周上を回る3つの動点の一致
ユーザー IDID
提出日時 2016-04-01 23:48:41
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,408 bytes
コンパイル時間 677 ms
コンパイル使用メモリ 76,284 KB
実行使用メモリ 16,832 KB
最終ジャッジ日時 2024-04-10 08:17:17
合計ジャッジ時間 13,269 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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
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;
	while(1) {
		if(tmpa == tmpb && tmpa == tmpc) break;
		int m = min(tmpa, min(tmpb, tmpc));
		if(m == tmpa) {
			tmpa += a;
		} else if(m == tmpb) {
			tmpb += b;
		} else if(m == tmpc) {
			tmpc += c;
		}
	}
	int lcm = tmpa;
	double aa = (double)tmpa/a, bb = (double)tmpb/b, cc = (double)tmpc/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