結果
| 問題 | No.736 約比 | 
| コンテスト | |
| ユーザー |  chocopuu | 
| 提出日時 | 2018-09-28 23:18:19 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 3 ms / 2,000 ms | 
| コード長 | 746 bytes | 
| コンパイル時間 | 1,584 ms | 
| コンパイル使用メモリ | 167,172 KB | 
| 実行使用メモリ | 6,824 KB | 
| 最終ジャッジ日時 | 2024-10-12 07:21:17 | 
| 合計ジャッジ時間 | 3,271 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 65 | 
コンパイルメッセージ
In function 'll gcd(ll, ll)',
    inlined from 'int main()' at main.cpp:35:14:
main.cpp:22:9: warning: 'x' may be used uninitialized [-Wmaybe-uninitialized]
   22 |         if(x==0) return y;
      |         ^~
main.cpp: In function 'int main()':
main.cpp:32:9: note: 'x' was declared here
   32 |     int x;
      |         ^
            
            ソースコード
#include <bits/stdc++.h>
#define int long long
using namespace std;
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
static const ll maxLL = (ll)1 << 62;
const ll MOD=1000000007,INF=1e18;
int dy[]={-1,0,1,0};
int dx[]={0,1,0,-1};
ll gcd(ll x,ll y)
{
	if(x==0) return y;
	return gcd(y%x,x);
}
int n;
int a[111];
int can[100010];
signed main(){
    cin>>n;
    int x;
    rep(i,0,n){
        cin>>a[i];
        x=gcd(x,a[i]);
    }
    rep(i,0,n){
        if(i==n-1)cout<<a[i]/x;
        else cout<<a[i]/x<<":";
    }
    cout<<endl;
    return 0;
}
            
            
            
        