結果
問題 | No.280 歯車の問題(1) |
ユーザー |
|
提出日時 | 2018-05-11 21:33:12 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 840 bytes |
コンパイル時間 | 548 ms |
コンパイル使用メモリ | 63,744 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-28 04:02:14 |
合計ジャッジ時間 | 2,850 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 31 |
ソースコード
// 解説を見てあ、そうじゃんってなった#include<iostream>using namespace std;int main(){long long a, b;int n;cin >> n;cin >> a;for(int i = 1; i < n; i++) cin >> b;cout << b << "/" << a << endl;return 0;}/*typedef long long ll;ll gcd(ll a, ll b){return b==0 ? a : gcd(b, a%b);}int main(){int n;ll mother, child;cin >> n >> mother >> child;ll g = gcd(mother,child);ll first = mother;ll second = child;mother /= g;child /= g;for(int i = 2; i < n; i++){first = second;cin >> second;g = gcd(first, second);mother *= first/g;child *= second/g;g = gcd(mother,child);mother /= g;child /= g;}cout << child << "/" << mother << endl;return 0;}*/