結果
| 問題 |
No.3362 積分!!!
|
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2025-11-20 12:44:03 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 696 bytes |
| コンパイル時間 | 646 ms |
| コンパイル使用メモリ | 61,280 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-11-20 12:44:05 |
| 合計ジャッジ時間 | 1,944 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 14 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:40:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
40 | scanf("%d%d%d", &n, &a, &b);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~
main.cpp:41:37: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
41 | for (int i = 0; i <= n; i++) scanf("%d", ks + i);
| ~~~~~^~~~~~~~~~~~~~
ソースコード
/* -*- 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;
using ld = long double;
/* global variables */
int ks[MAX_N];
/* subroutines */
ld itgf(int n, int ks[], int x) {
ld 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);
ld x = floorl(itgf(n, ks, b) - itgf(n, ks, a));
printf("%lld\n", (ll)x);
return 0;
}
tnakao0123