QOJ.ac

QOJ

حد الوقت: 1 s حد الذاكرة: 16 MB مجموع النقاط: 10

#11670. 多项式 2

الإحصائيات

对于给定的多项式 $W$ 和给定的数 $x$,求出表达式 $W(x)$ 的最后三位数字(百位、十位和个位)。

编写一个程序,完成以下任务:

  • 读取多项式 $W$ 的描述以及数字 $x$;
  • 计算表达式 $W(x)$ 的最后三位数字;
  • 输出结果。

第一行包含两个整数 $s$ ($1 \le s \le 20\,000$) 和 $x$ ($-1\,000\,000 \le x \le 1\,000\,000$)。第二行包含 $s$ 个整数 $w_1, w_2, \ldots, w_s$ ($-1\,000\,000 \le w_k \le 1\,000\,000$),中间用空格隔开。这些数字是多项式的系数,满足 $W(x) = w_1x^{s-1} + w_2x^{s-2}+\ldots+w_{s-1}x+w_s$。

你的程序应输出由表达式 $W(x)$ 的最后三位数字组成的字符串,顺序从百位到个位。

样例

输入格式 1

3 2
5 6 7

输出格式 1

039

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.