結果

問題 No.21 平均の差
ユーザー Shopetan
提出日時 2017-07-04 23:23:00
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,328 bytes
コンパイル時間 2,038 ms
コンパイル使用メモリ 194,700 KB
最終ジャッジ日時 2025-01-05 01:10:43
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 10
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:29: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 | # define int(x) int x; scanf("%d",&x);
      |                        ~~~~~^~~~~~~~~
main.cpp:51:3: note: in expansion of macro ‘int’
   51 |   int(n);
      |   ^~~
main.cpp:10:52: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 | # define vint(v,n) vector<int> v(n); REP(i,n) scanf("%d", &v[i]);
      |                                               ~~~~~^~~~~~~~~~~~~
main.cpp:52:3: note: in expansion of macro ‘vint’
   52 |   vint(a,n);
      |   ^~~~

ソースコード

diff #

# include <bits/stdc++.h>

# define FOR(i,a,b) for (int i=(a);i<(b);i++)
# define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
# define REP(i, n) for (int i = 0; i < (int)(n); i++)
# define RREP(i,n) for (int i=(n)-1;i>=0;i--)

# define int(x) int x; scanf("%d",&x);
# define double(x) double x; scanf("%lf",&x);
# define vint(v,n) vector<int> v(n); REP(i,n) scanf("%d", &v[i]);
# define string(x) string x; cin >> x;

using namespace std;

namespace utils{
  template <typename T> void print(vector<vector<T>> mat) {
    REP (i, mat.size()) {
      REP (j, mat[0].size()) cout << mat[i][j] << ' ';
      cout << endl;
    }
  }

  template <typename T> void print(vector<T> v) {
    REP (i, v.size())
      if (i >= v.size()-1)
	cout << v[i];
      else
	cout << v[i] << ' ';
    
    cout << endl;
  }

  template <typename T> pair<T, T> shape(vector<vector<T>> mat) {
    int d1, d2;

    d1 = mat.size();
    if (d1 > 0) d2 = mat[0].size();
    else int d2 = 0;
    cout << "(" << d1 << ", " << d2 << ")" << endl;
    return make_pair(0, 0);
  }

  template <typename T> vector<vector<T>> empty(int n, int m) {
    vector<vector<T>> mat(n, vector<T>(m));
    return mat;
  }
}


int main() {
  int(n);
  vint(a,n);
  
  int ans = ceil(*max_element(a.begin(),a.end()) - *min_element(a.begin(),a.end()));
  cout << ans << endl;
}
0