結果

問題 No.356 円周上を回る3つの動点の一致
ユーザー kotatsugame
提出日時 2020-02-14 21:21:47
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 438 bytes
コンパイル時間 618 ms
コンパイル使用メモリ 65,648 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-06 10:21:34
合計ジャッジ時間 2,376 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17 WA * 31
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
using namespace std;
long T1,T2,T3;
long gcd(long a,long b){return b?gcd(b,a%b):a;}
main()
{
	cin>>T1>>T2>>T3;
	for(long k=1;k<=10000;k++)
	{
		long ta=T1*T2*k,tb=T2-T1;
		long g=gcd(ta,tb);
		ta/=g;tb/=g;
		long a1,b1,a2,b2;
		a1=ta,b1=tb*T1;
		g=gcd(a1,b1);
		a1/=g;b1/=g;
		a1%=b1;
		a2=ta,b2=tb*T3;
		g=gcd(a2,b2);
		a2/=g;b2/=g;
		a2%=b2;
		if(a1==a2&&b1==b2)
		{
			cout<<ta<<"/"<<tb<<endl;
			return 0;
		}
	}
}
0