結果
問題 |
No.3002 多項式の割り算 〜easy〜
|
ユーザー |
![]() |
提出日時 | 2025-01-11 19:10:48 |
言語 | D (dmd 2.109.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 453 bytes |
コンパイル時間 | 2,768 ms |
コンパイル使用メモリ | 90,700 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2025-01-11 19:10:52 |
合計ジャッジ時間 | 1,954 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 20 WA * 1 RE * 1 |
ソースコード
import std.algorithm, std.array, std.conv, std.stdio, std.typecons; auto solve(long A, long B) { auto c = new long[B+1]; c[B] = A; auto i = 0; while (i <= B-2) { c[B-i-1] -= c[B-i]; c[B-i-2] -= c[B-i]; i += 1; } return tuple(c[1], c[0]); } void main() { auto AB = readln.split.to!(long[]); auto ans = solve(AB[0], AB[1]); if (AB[0] == 0) writeln("0 ", AB[0]); else if (AB[1] == 1) writeln(AB[0], " 0"); writeln(ans[0], " ", ans[1]); }