結果

問題 No.339 何人が回答したのか
ユーザー naimonon77
提出日時 2016-02-09 19:14:45
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 643 bytes
コンパイル時間 1,182 ms
コンパイル使用メモリ 159,864 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-21 22:01:34
合計ジャッジ時間 2,576 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 61
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <string>
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

int main() {
  int i,j,k;
  int n;
  int a,cnt5=0,cnt2=0;
  cin >> n;
  for(i=0;i<n;i++) {
    cin >> a;
    int tmp5=2,tmp2=2;
    while(a % 5 == 0) {
      tmp5--;
      a /= 5;
    }
    
    while(a % 2 == 0) {
      tmp2--;
      a /= 2;
    }
    if(cnt5 < tmp5) cnt5 = tmp5;
    if(cnt2 < tmp2) cnt2 = tmp2;
  }
  int rep = 1;
  for(i=0;i<cnt2;i++) rep *= 2;
  for(i=0;i<cnt5;i++) rep *= 5;
  cout << rep << endl;
  return 0;
}
0