結果

問題 No.3362 積分!!!
コンテスト
ユーザー tnakao0123
提出日時 2025-11-20 12:41:12
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 683 bytes
コンパイル時間 494 ms
コンパイル使用メモリ 60,892 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-11-20 12:41:14
合計ジャッジ時間 1,429 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 6
other AC * 13 WA * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:39:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   39 |   scanf("%d%d%d", &n, &a, &b);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~
main.cpp:40:37: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   40 |   for (int i = 0; i <= n; i++) scanf("%d", ks + i);
      |                                ~~~~~^~~~~~~~~~~~~~

ソースコード

diff #
raw source code

/* -*- coding: utf-8 -*-
 *
 * 3362.cc:  No.3362 遨榊・!!! - yukicoder
 */

#include<cstdio>
#include<cmath>
#include<algorithm>

using namespace std;

/* constant */

const int MAX_N = 10 + 1;

/* typedef */

using ll = long long;

/* global variables */

int ks[MAX_N];

/* subroutines */

double itgf(int n, int ks[], int x) {
  double ex = x, sum = 0.0;
  for (int i = 0; i <= n; i++) {
    sum += ks[i] * ex / (i + 1);
    ex *= x;
  }
  return sum;
}

/* main */

int main() {
  int n, a, b;
  scanf("%d%d%d", &n, &a, &b);
  for (int i = 0; i <= n; i++) scanf("%d", ks + i);

  double x = floor(itgf(n, ks, b) - itgf(n, ks, a));
  printf("%lld\n", (ll)x);
  
  return 0;
}

0