結果
問題 |
No.3002 多項式の割り算 〜easy〜
|
ユーザー |
![]() |
提出日時 | 2025-02-16 19:08:19 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 666 bytes |
コンパイル時間 | 2,277 ms |
コンパイル使用メモリ | 192,540 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2025-02-16 19:08:23 |
合計ジャッジ時間 | 3,457 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); ll A; int B; cin >> A >> B; ll c0 = 0, d0 = 1; ll c1 = 1, d1 = 0; if(B == 0){ cout << 0 << " " << A << "\n"; return 0; } if(B == 1){ cout << A << " " << 0 << "\n"; return 0; } ll c, d; for(int n = 2; n <= B; n++){ c = - c1 - c0; d = - d1 - d0; c0 = c1; d0 = d1; c1 = c; d1 = d; } ll a = A * c1; ll b = A * d1; cout << a << " " << b << "\n"; return 0; }