結果

問題 No.3362 積分!!!
コンテスト
ユーザー DeltaStruct
提出日時 2025-11-17 22:08:54
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 511 bytes
コンパイル時間 1,948 ms
コンパイル使用メモリ 198,900 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-11-17 22:08:57
合計ジャッジ時間 3,041 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 6
other AC * 6 WA * 8
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:53: warning: range-based ‘for’ loops with initializer only available with ‘-std=c++20’ or ‘-std=gnu++20’ [-Wc++20-extensions]
    8 |         vector<pair<int,int>> A(n+1); for (int i(0);auto& [a,b]:A) (cin>>a),b = ++i;
      |                                                     ^~~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
// 定積分は微分するとf(x)になるg(x)(ただし定数項=0)にてg(B)-g(A)で求まるらしい

int main(){
#define int long long
	int n,x,y; cin >> n >> x >> y;
	vector<pair<int,int>> A(n+1); for (int i(0);auto& [a,b]:A) (cin>>a),b = ++i;
	long double r = 0;
	for (int i(0),k(x);i <= n;++i,k*=x) r -= ((long double)A[i].first*k)/A[i].second;
	for (int i(0),k(y);i <= n;++i,k*=y) r += ((long double)A[i].first*k)/A[i].second;
	cout << floor(r) << endl;
}
0