結果
問題 |
No.40 多項式の割り算
|
ユーザー |
![]() |
提出日時 | 2016-05-09 10:29:38 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 667 bytes |
コンパイル時間 | 179 ms |
コンパイル使用メモリ | 21,760 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-05 13:05:24 |
合計ジャッジ時間 | 985 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 |
コンパイルメッセージ
main.c:15:1: warning: return type defaults to ‘int’ [-Wimplicit-int] 15 | main(void) { | ^~~~ main.c: In function ‘main’: main.c:17:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 17 | scanf("%td", &D); | ^~~~~~~~~~~~~~~~ main.c:19:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 19 | scanf("%td", &a[i]); | ^~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> #include <stdlib.h> #include <stddef.h> #define int ptrdiff_t #define div lldiv #define div_t lldiv_t #define abs(a) ((a)<0?-(a):(a)) #define min(a,b) ((a)<(b)?(a):(b)) int D; int a[100000]; int b[4] = {0, -1, 0, 1}; main(void) { int i,j; scanf("%td", &D); for (i = 0; i <= D; i++) scanf("%td", &a[i]); for (i = D; i >= 3; i--) { int t = a[i] / b[3]; for (j = 3; j >= 0; j--) a[i-3+j] -= t * b[j]; } for (i = 2; i >= 1; i--) if (a[i] != 0) break; printf("%td\n", i); for (j = 0; j <= i; j++) printf("%td ", a[j]); printf("\n"); return 0; }