結果
問題 | No.40 多項式の割り算 |
ユーザー |
![]() |
提出日時 | 2015-07-27 11:06:38 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 379 bytes |
コンパイル時間 | 187 ms |
コンパイル使用メモリ | 20,608 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-16 04:06:30 |
合計ジャッジ時間 | 1,533 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:6:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 6 | scanf("%d",&D); | ^~~~~~~~~~~~~~ main.c:13:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 13 | scanf("%d",&A); | ^~~~~~~~~~~~~~
ソースコード
#include<stdio.h> int main(void){ int D; scanf("%d",&D); int a,b,c; a=b=c=0; int i; for(i=0;i<=D;i++){ int A; scanf("%d",&A); a+=A*(i==0?1:0); b+=A; c+=A*(i%2==0?1:-1); } int x,y,z; z=a; y=(b-c)/2; x=(b+c-2*a)/2; if(x!=0){ printf("2\n%d %d %d\n",z,y,x); } else if(y!=0){ printf("1\n%d %d\n",z,y); } else { printf("0\n%d\n",z); } return 0; }