結果
問題 |
No.3002 多項式の割り算 〜easy〜
|
ユーザー |
![]() |
提出日時 | 2025-01-17 21:43:16 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 751 bytes |
コンパイル時間 | 4,374 ms |
コンパイル使用メモリ | 303,728 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2025-01-17 21:43:34 |
合計ジャッジ時間 | 5,166 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; const int INF = 1e9 + 10; const ll INFL = 4e18; #include <atcoder/convolution> int main() { ll A, B; cin >> A >> B; if (A == 0) { cout << 0 << ' ' << 0 << endl; return 0; } if (B == 0) { cout << 0 << ' ' << A << endl; return 0; } else if (B == 1) { cout << A << ' ' << 0 << endl; return 0; } else if (B == 2) { cout << -A << ' ' << -A << endl; return 0; } vector<ll> a(B), b = {1, 1, 1}; a[B - 2] = A; a[B - 3] = -A; for (int i = B - 4; i >= 0; i--) a[i] = -a[i + 1] - a[i + 2]; auto c = atcoder::convolution_ll(a, b); cout << -c[1] << ' ' << -c[0] << endl; }