結果
| 問題 |
No.3362 積分!!!
|
| コンテスト | |
| ユーザー |
noya2
|
| 提出日時 | 2025-11-10 00:56:02 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,116 bytes |
| コンパイル時間 | 3,206 ms |
| コンパイル使用メモリ | 279,928 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-11-17 20:44:18 |
| 合計ジャッジ時間 | 3,684 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 11 WA * 3 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll = __int128_t;
ll input(){
string s; cin >> s;
ll x = 0;
bool neg = false;
if (s[0] == '-'){
neg = true;
s = s.substr(1);
}
for (auto c : s){
x *= 10;
x += ll(c - '0');
}
if (neg) x = -x;
return x;
}
void output(ll x){
if (x == 0){
cout << 0 << endl;
return ;
}
string s = "";
bool neg = false;
if (x < 0){
neg = true;
x = -x;
}
while (x){
s += char(x % 10 + '0');
x /= 10;
}
reverse(s.begin(),s.end());
if (neg) cout << '-';
cout << s << endl;
}
int main(){
int n; cin >> n;
ll a = input(), b = input();
ll iv = 1;
for (int i = 0; i <= n; i++){
iv *= (i + 1) / gcd((long long)iv, i + 1);
}
ll sum = 0;
ll ap = 1, bp = 1;
for (int i = 0; i <= n; i++){
ap *= a;
bp *= b;
ll k = input();
sum += k * (bp - ap) * (iv / (i + 1));
}
ll ans = sum / iv;
if (sum % iv != 0 && sum < 0){
ans++;
}
output(ans);
}
noya2