結果
問題 |
No.3002 多項式の割り算 〜easy〜
|
ユーザー |
![]() |
提出日時 | 2025-01-11 19:11:06 |
言語 | D (dmd 2.109.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 458 bytes |
コンパイル時間 | 2,499 ms |
コンパイル使用メモリ | 87,808 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2025-01-11 19:11:11 |
合計ジャッジ時間 | 2,112 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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"); else writeln(ans[0], " ", ans[1]); }