結果
| 問題 | 
                            No.339 何人が回答したのか
                             | 
                    
| コンテスト | |
| ユーザー | 
                             tetsuzuki1115
                         | 
                    
| 提出日時 | 2018-02-02 01:33:24 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                RE
                                 
                             
                            
                            (最新)
                                AC
                                 
                             
                            (最初)
                            
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 704 bytes | 
| コンパイル時間 | 907 ms | 
| コンパイル使用メモリ | 85,572 KB | 
| 実行使用メモリ | 6,824 KB | 
| 最終ジャッジ日時 | 2024-11-27 11:59:32 | 
| 合計ジャッジ時間 | 10,685 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 RE * 2 | 
| other | RE * 61 | 
コンパイルメッセージ
main.cpp: In function 'int gcd(int, int)':
main.cpp:23:8: warning: control reaches end of non-void function [-Wreturn-type]
   23 |     gcd( b, a%b );
      |     ~~~^~~~~~~~~~
            
            ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;
long long MOD = 1000000007;
int gcd( int a, int b ) {
    
    if ( b == 0 ) { return a; }
    
    gcd( b, a%b );
}
int main() {
    
    int N;
    cin >> N;
    vector<int> A(N);
    int s = 0;
    for ( int i = 0; i < N; i++ ) {
        cin >> A[i];
        s += A[i];
    }
    
    int a = A[0];
    for ( int i = 1; i < N; i++ ) {
        a = gcd( a, A[i] );
    }
    
    cout << ( s / a ) << endl;
    
    
    
    return 0;
}
            
            
            
        
            
tetsuzuki1115