結果

問題 No.229 線分上を往復する3つの動点の一致
ユーザー Kmcode1
提出日時 2015-06-19 23:48:29
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 1,432 bytes
コンパイル時間 929 ms
コンパイル使用メモリ 100,232 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-07 04:28:01
合計ジャッジ時間 1,731 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14 WA * 29
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:64:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   64 |                 scanf("%d", &a);
      |                 ~~~~~^~~~~~~~~~

ソースコード

diff #

#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cctype>
#include<cstdlib>
#include<algorithm>
#include<bitset>
#include<vector>
#include<list>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<ctime>
#include<complex>
#include<functional>
#include<climits>
#include<cassert>
#include<iterator>
#include<unordered_map>
using namespace std;
#define MOD 1000000007
namespace math{
	unsigned long long int gcd(unsigned long long int a, unsigned long long int b){
		if (a > b){
			swap(a, b);
		}
		while (a){
			swap(a, b);
			a %= b;
		}
		return b;
	}
	unsigned long long int lcm(long long int a, long long int b){
		unsigned long long int g =gcd(a, b);
		a /= g;
		return a*b;
	}
}
using namespace math;
struct st{
	long long int u;
	long long int s;
	st(long long int u_ = 0,long long int s_=0){
		u = u_;
		s = s_;
	}
};
void y(st &a){
	long long int g = gcd(a.s, a.u);
	a.s /= g;
	a.u /= g;
}
vector<unsigned long long int> v;
int main(){
	for (int i = 0; i < 3; i++){
		int a;
		scanf("%d", &a);
		v.push_back(a);
	}
	sort(v.begin(), v.end());
	st k = st(v[0] * v[1] * (v[1] + v[2]), (v[2] + v[1])*(v[0] + v[1]));
	st kk = st(v[2] * v[1] * (v[1] + v[0]), (v[2] + v[1])*(v[0] + v[1]));
	unsigned long long int B = lcm(k.u, kk.u);
	k.u = B;
	y(k);
	printf("%lld/%lld\n", k.u, k.s);
	return 0;
}
0