結果
問題 | No.736 約比 |
ユーザー |
![]() |
提出日時 | 2018-09-28 21:40:41 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 539 bytes |
コンパイル時間 | 1,500 ms |
コンパイル使用メモリ | 170,624 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-12 05:46:57 |
合計ジャッジ時間 | 9,736 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | RE * 65 |
コンパイルメッセージ
main.cpp: In function 'll gcd(ll, ll)': main.cpp:13:20: warning: control reaches end of non-void function [-Wreturn-type] 13 | gcd(b,a); | ~~~^~~~~
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pii; #define pb push_back #define mp make_pair #define rep(i,n) for(int i=0;i<(n);++i) ll gcd(ll a,ll b){ if(a%b==0) return b; else{ a%=b; gcd(b,a); } } int main(){ cin.tie(0); ios::sync_with_stdio(false); ll n;cin >> n; vector<ll> a(n); rep(i,n) cin >> a.at(i); ll g=gcd(a.at(0),a.at(1)); for(int i=2;i<n;++i){ g=gcd(g,a.at(i)); } rep(i,n){ a.at(i)/=g; if(i==n-1) cout << a.at(i) << endl; else cout << a.at(i) << ":"; } }