結果

問題 No.339 何人が回答したのか
ユーザー troro_kelptroro_kelp
提出日時 2018-08-28 17:44:28
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 5 ms / 1,000 ms
コード長 1,423 bytes
コンパイル時間 767 ms
コンパイル使用メモリ 96,172 KB
実行使用メモリ 8,376 KB
最終ジャッジ日時 2023-09-23 03:43:19
合計ジャッジ時間 3,661 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
8,088 KB
testcase_01 AC 5 ms
8,036 KB
testcase_02 AC 4 ms
8,096 KB
testcase_03 AC 4 ms
8,096 KB
testcase_04 AC 4 ms
8,148 KB
testcase_05 AC 5 ms
8,136 KB
testcase_06 AC 4 ms
8,376 KB
testcase_07 AC 4 ms
8,120 KB
testcase_08 AC 4 ms
8,100 KB
testcase_09 AC 4 ms
8,096 KB
testcase_10 AC 5 ms
8,136 KB
testcase_11 AC 4 ms
8,120 KB
testcase_12 AC 4 ms
8,088 KB
testcase_13 AC 5 ms
8,096 KB
testcase_14 AC 4 ms
8,120 KB
testcase_15 AC 4 ms
8,376 KB
testcase_16 AC 4 ms
8,140 KB
testcase_17 AC 4 ms
8,096 KB
testcase_18 AC 5 ms
8,268 KB
testcase_19 AC 4 ms
8,124 KB
testcase_20 AC 4 ms
8,032 KB
testcase_21 AC 4 ms
8,096 KB
testcase_22 AC 4 ms
8,136 KB
testcase_23 AC 4 ms
8,036 KB
testcase_24 AC 4 ms
8,088 KB
testcase_25 AC 4 ms
8,040 KB
testcase_26 AC 4 ms
8,036 KB
testcase_27 AC 4 ms
8,092 KB
testcase_28 AC 4 ms
8,112 KB
testcase_29 AC 4 ms
8,120 KB
testcase_30 AC 4 ms
8,092 KB
testcase_31 AC 5 ms
8,088 KB
testcase_32 AC 5 ms
8,088 KB
testcase_33 AC 4 ms
8,032 KB
testcase_34 AC 4 ms
8,036 KB
testcase_35 AC 4 ms
8,136 KB
testcase_36 AC 4 ms
8,088 KB
testcase_37 AC 5 ms
8,120 KB
testcase_38 AC 4 ms
8,256 KB
testcase_39 AC 4 ms
8,152 KB
testcase_40 AC 4 ms
8,092 KB
testcase_41 AC 4 ms
8,124 KB
testcase_42 AC 4 ms
8,092 KB
testcase_43 AC 4 ms
8,096 KB
testcase_44 AC 4 ms
8,092 KB
testcase_45 AC 5 ms
8,188 KB
testcase_46 AC 4 ms
8,092 KB
testcase_47 AC 4 ms
8,084 KB
testcase_48 AC 4 ms
8,252 KB
testcase_49 AC 4 ms
8,032 KB
testcase_50 AC 4 ms
8,084 KB
testcase_51 AC 4 ms
8,096 KB
testcase_52 AC 5 ms
8,040 KB
testcase_53 AC 4 ms
8,148 KB
testcase_54 AC 4 ms
8,140 KB
testcase_55 AC 4 ms
8,092 KB
testcase_56 AC 4 ms
8,032 KB
testcase_57 AC 4 ms
8,092 KB
testcase_58 AC 4 ms
8,088 KB
testcase_59 AC 4 ms
8,156 KB
testcase_60 AC 4 ms
8,088 KB
testcase_61 AC 5 ms
8,120 KB
testcase_62 AC 4 ms
8,032 KB
testcase_63 AC 4 ms
8,148 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>
#include <climits>
#include <iterator>
#include <iomanip>
#include <stack>
#include <set>
#include <bitset>
#include <functional>
using namespace std;
const constexpr int INF = 1e9;
//typedef std::pair<std::string,double> P;


#define FOR(i, a, n) for (ll i = (ll)a; i<(ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)

typedef long long ll;
typedef vector<int> VI;
const constexpr ll MOD = 1e9+7;
vector<pair<int, int> > vp;
 
struct Less {
    bool operator()(const pair<int, int>& x, const pair<int, int>& y) const {
        return x.first > y.first;
    }
};

ll GCD(ll a, ll b){
    if(b==0) return a;
    return GCD(b, a%b);
}


//グラフの隣接リスト
VI g[200010];
//頂点の入次数を管理
int h[100010];
string s;
int a[101];
int b[100010]={INF};
int main(void) {
    int N; cin >> N;
    REP(i, N) cin >> a[i];
    for(int i=2; i<=100; ++i){
        
        while(1){
            bool ok=true;
            for(int j=0; j<N; ++j){
                if(a[j]%i!=0) ok = false;
            }
            if(ok) {
                for(int j=0; j<N; ++j){
                    a[j] = a[j]/i;
                }
            }else{
                break;
            }
        }
    }
    int ans=0;
    for(int i=0; i<N; ++i) ans += a[i];
    
    cout << ans << endl;
    
}
0