結果
| 問題 | No.3362 積分!!! |
| ユーザー |
|
| 提出日時 | 2026-11-13 11:59:16 |
| 言語 | C++23 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 1 ms / 2,000 ms |
| + 799µs | |
| コード長 | 918 bytes |
| 記録 | |
| コンパイル時間 | 2,478 ms |
| コンパイル使用メモリ | 334,540 KB |
| 実行使用メモリ | 9,868 KB |
| 最終ジャッジ日時 | 2026-11-13 11:59:23 |
| 合計ジャッジ時間 | 4,306 ms |
|
ジャッジサーバーID (参考情報) |
judge5_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 20 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
struct R{
//de>0
__int128 nu,de;
bool operator<(const R& other) const {
return (__int128)nu*other.de<(__int128)de*other.nu;
}
bool operator==(const R& other) const {
return (__int128)nu*other.de==(__int128)de*other.nu;
}
R operator+(const R& other) const {
return {nu*other.de+de*other.nu,de*other.de};
}
};
int main(void){
int n;
long long a,b;
cin>>n>>a>>b;
R ans={0,1};
for(int i=0;i<=n;i++){
long long k;
cin>>k;
long long ta=1,tb=1;
for(int j=0;j<=i;j++){
ta*=a;
tb*=b;
}
ans=ans+(R){k*(tb-ta),i+1};
}
if(ans.nu==0){
cout<<0<<endl;
}else if(ans.nu<0){
cout<<(long long)(-(-ans.nu+ans.de-1)/ans.de)<<endl;
}else{
cout<<(long long)(ans.nu/ans.de)<<endl;
}
return 0;
}