結果
問題 | No.339 何人が回答したのか |
ユーザー |
![]() |
提出日時 | 2016-01-30 18:38:01 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
RE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 972 bytes |
コンパイル時間 | 1,397 ms |
コンパイル使用メモリ | 159,772 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-21 19:26:54 |
合計ジャッジ時間 | 10,973 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 3 |
other | RE * 61 |
コンパイルメッセージ
main.cpp: In instantiation of ‘T read(T&) [with T = int]’: main.cpp:25:13: required from here main.cpp:13:41: warning: no return statement in function returning non-void [-Wreturn-type] 13 | template<class T> T read(T& a){cin >> a;} | ^
ソースコード
#include "bits/stdc++.h"using namespace std;typedef long long ll;typedef unsigned long long ull;typedef vector<int> veci;typedef vector<string> vecs;#define REP(i, a, n) for(ll i = a; i < n; i++)#define rep(i, n) REP(i, 0, n)template<class T> T read(){T a;cin >> a;return a;}template<class T> T read(T& a){cin >> a;}template<class T> void rarr(T a, int n){for(int i = 0; i < n; i++) {cin >> a[i];}}template<class T> void write(T a){cout << a << endl;}void write(double a){cout << fixed << setprecision(12) << a << endl;}template<class T> void warr(T a, int n, char* c = " "){cout << a[0];for(int i = 1; i < n; i++)cout << c << a[i];cout << endl;}ll gcd(ll a, ll b){while(true){ll k = a % b;if(k == 0)return b;a = b;b = k;}}int main(void){int n = read<int>();int a[100];rep(i,n)read(a[i]);int k = a[0];REP(i,1,n)k = gcd(k,a[i]);int res = 0;rep(i,n)res += a[i]/k;write(res);return 0;}