結果
| 問題 | No.339 何人が回答したのか |
| コンテスト | |
| ユーザー |
nenuon
|
| 提出日時 | 2017-07-13 21:05:23 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 798 bytes |
| コンパイル時間 | 884 ms |
| コンパイル使用メモリ | 89,900 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-07 18:29:49 |
| 合計ジャッジ時間 | 2,596 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 61 |
ソースコード
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
typedef long long ll;
// 最小公倍数で割った値の総和
//最大公約数
int gcd(int a, int b) {
while (a && b) {
if (a >= b) a %= b;
else b %= a;
}
return a + b;
}
int main(){
int N;
cin>>N;
int A[N];
FOR(i,0,N) cin >> A[i];
if(N==1)
{
cout << 1 << endl;
return 0;
}
int LCM = gcd(A[0], A[1]);
FOR(i,2,N)
{
LCM = gcd(LCM, A[i]);
}
int ans = 0;
FOR(i,0,N) ans += A[i] / LCM;
cout << ans << endl;
return 0;
}
nenuon