結果

問題 No.736 約比
ユーザー asdf1asdf1
提出日時 2018-09-28 21:51:13
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 1,185 bytes
コンパイル時間 3,298 ms
コンパイル使用メモリ 144,600 KB
実行使用メモリ 5,664 KB
最終ジャッジ日時 2023-08-02 11:12:56
合計ジャッジ時間 5,508 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,608 KB
testcase_01 AC 2 ms
5,388 KB
testcase_02 AC 2 ms
5,592 KB
testcase_03 AC 2 ms
5,388 KB
testcase_04 AC 2 ms
5,440 KB
testcase_05 AC 2 ms
5,420 KB
testcase_06 AC 2 ms
5,496 KB
testcase_07 AC 2 ms
5,424 KB
testcase_08 AC 2 ms
5,476 KB
testcase_09 AC 2 ms
5,432 KB
testcase_10 AC 2 ms
5,608 KB
testcase_11 AC 2 ms
5,544 KB
testcase_12 AC 2 ms
5,604 KB
testcase_13 AC 2 ms
5,472 KB
testcase_14 AC 2 ms
5,480 KB
testcase_15 AC 2 ms
5,600 KB
testcase_16 AC 2 ms
5,420 KB
testcase_17 AC 2 ms
5,428 KB
testcase_18 AC 2 ms
5,572 KB
testcase_19 AC 2 ms
5,396 KB
testcase_20 AC 2 ms
5,432 KB
testcase_21 AC 2 ms
5,428 KB
testcase_22 AC 2 ms
5,424 KB
testcase_23 AC 2 ms
5,600 KB
testcase_24 AC 2 ms
5,392 KB
testcase_25 AC 2 ms
5,480 KB
testcase_26 AC 2 ms
5,424 KB
testcase_27 AC 2 ms
5,432 KB
testcase_28 AC 2 ms
5,548 KB
testcase_29 AC 2 ms
5,480 KB
testcase_30 AC 2 ms
5,392 KB
testcase_31 AC 2 ms
5,476 KB
testcase_32 AC 2 ms
5,480 KB
testcase_33 AC 2 ms
5,500 KB
testcase_34 AC 2 ms
5,400 KB
testcase_35 AC 2 ms
5,664 KB
testcase_36 AC 2 ms
5,496 KB
testcase_37 AC 2 ms
5,428 KB
testcase_38 AC 2 ms
5,392 KB
testcase_39 AC 2 ms
5,388 KB
testcase_40 AC 2 ms
5,428 KB
testcase_41 AC 2 ms
5,408 KB
testcase_42 AC 2 ms
5,496 KB
testcase_43 AC 2 ms
5,640 KB
testcase_44 AC 2 ms
5,476 KB
testcase_45 AC 2 ms
5,408 KB
testcase_46 AC 2 ms
5,396 KB
testcase_47 AC 2 ms
5,384 KB
testcase_48 AC 2 ms
5,540 KB
testcase_49 AC 2 ms
5,484 KB
testcase_50 AC 2 ms
5,380 KB
testcase_51 AC 2 ms
5,652 KB
testcase_52 AC 2 ms
5,396 KB
testcase_53 AC 2 ms
5,388 KB
testcase_54 AC 2 ms
5,432 KB
testcase_55 AC 3 ms
5,400 KB
testcase_56 AC 3 ms
5,480 KB
testcase_57 AC 2 ms
5,424 KB
testcase_58 AC 2 ms
5,396 KB
testcase_59 AC 2 ms
5,432 KB
testcase_60 AC 2 ms
5,656 KB
testcase_61 AC 2 ms
5,404 KB
testcase_62 AC 2 ms
5,396 KB
testcase_63 AC 2 ms
5,540 KB
testcase_64 AC 2 ms
5,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl

typedef long long ll;

using namespace std;

const int INF = 1e9,MOD = 1e9 + 7,ohara = 1e6;
const ll LINF = 1e18;
long long int n,cnt=0,ans[ohara],a[ohara],b,c,d,cmp,cmpp,m,h,w,x,y,sum=0,pos;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

int main(void){
  
       cin.tie(0);
    ios::sync_with_stdio(false);
      
      cin>>n;
      rep(i,n)cin>>a[i],ans[i]=a[i];
      while(1){
        pos=ans[0];
        rrep(i,1,n){
          pos=__gcd(pos,ans[i]);
        }
        //Cout(pos);
        if(pos==1)break;
        rep(i,n)ans[i]/=pos;
      }
      rep(i,n){
        if(i==n-1){
          cout<<ans[i]<<"\n";
        }
        else{
          cout<<ans[i]<<":";
        }
      }
    
       
return 0;
}
0