結果

問題 No.736 約比
コンテスト
ユーザー chocopuu
提出日時 2018-09-28 23:18:19
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 746 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 956 ms
コンパイル使用メモリ 179,168 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-04-28 19:11:37
合計ジャッジ時間 2,845 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 36 WA * 29
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;
      |         ^

ソースコード

diff #
raw source code

#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;
}
0