結果
| 問題 | No.229 線分上を往復する3つの動点の一致 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-08-02 14:45:26 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 1,494 bytes |
| 記録 | |
| コンパイル時間 | 976 ms |
| コンパイル使用メモリ | 176,424 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-04-27 12:27:31 |
| 合計ジャッジ時間 | 2,403 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 43 |
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/ostream:42,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/istream:43,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/sstream:42,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/complex:50,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/ccomplex:43,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/x86_64-pc-linux-gnu/bits/stdc++.h:133,
from main.cpp:1:
In member function 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>]',
inlined from 'int main()' at main.cpp:59:13:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/ostream.h:212:25: warning: 'ans1' may be used uninitialized [-Wmaybe-uninitialized]
212 | { return _M_insert(__n); }
| ~~~~~~~~~^~~~~
main.cpp: In function 'int main()':
main.cpp:41:8: note: 'ans1' was declared here
41 | ll ans1,ans2;
| ^~~~
In member function 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>]',
inlined from 'int main()' at main.cpp:59:28:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/ostream.h:212:25: warning: 'ans2' may be used uninitialized [-Wmaybe-uninitialized]
212 | { return _M_insert(__n); }
| ~~~~~~~~~^~~~~
main.cpp: In function 'int main()':
main.cpp:41:13: note: 'ans2' was declared here
41 | ll ans1,ans2;
| ^~~~
ソースコード
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(a, b) for(auto (a): (b))
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define pb push_back
#define show(x) cout <<#x<<" = "<<(x)<<endl
#define spair(p) cout <<#p<<": "<<p.fi<<" "<<p.se<<endl
#define svec(v) cout<<#v<<":";rep(kbrni,v.size())cout<<" "<<v[kbrni];cout<<endl
#define sset(s) cout<<#s<<":";each(kbrni,s)cout <<" "<<kbrni;cout<<endl
using namespace std;
typedef pair<int,int>P;
const int MAX_N = 100005;
ll gcd(ll a,ll b)
{
if(a%b == 0){
return b;
}else{
return gcd(b,a%b);
}
}
int main()
{
cin.tie(0);
ios::sync_with_stdio(false);
int t1,t2,t3;
cin >> t1 >> t2 >> t3;
vector<int> v1={t2+t1,t2-t1};
vector<int> v2={t3+t1,t3-t1};
double mn = 1e100;
ll ans1,ans2;
rep(i,2){
rep(j,2){
ll num1 = gcd(v1[i],t1*t2);
ll a1 = (v1[i])/num1;
ll a2 = (t1*t2)/num1;
ll num2 = gcd(v2[j],t1*t3);
ll a3 = (v2[j])/num2;
ll a4 = (t1*t3)/num2;
ll si = a2*a4 / gcd(a2,a4);
ll bo = gcd(a1,a3);
if(mn > (double)si/bo){
mn = (double)si/bo;
ll hoge = gcd(si,bo);
ans1 = si/hoge,ans2 = bo/hoge;
}
}
}
cout << ans1 << "/" << ans2 << endl;
return 0;
}