HDU 1296 (表达式求值)
来源:互联网 发布:h5游戏源码购买 编辑:程序博客网 时间:2024/04/27 14:37
Polynomial Problem
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 219 Accepted Submission(s): 103
Problem Description
We have learned how to obtain the value of a polynomial when we were a middle school student. If f(x) is a polynomial of degree n, we can let
If we have x, we can get f(x) easily. But a computer can not understand the expression like above. So we had better make a program to obtain f(x).
Input
There are multiple cases in this problem and ended by the EOF. In each case, there are two lines. One is an integer means x (0<=x<=10000), the other is an expression means f(x). All coefficients ai(0<=i<=n,1<=n<=10,-10000<=ai<=10000) are integers. A correct expression maybe likes
1003X^5+234X^4-12X^3-2X^2+987X-1000
1003X^5+234X^4-12X^3-2X^2+987X-1000
Output
For each test case, there is only one integer means the value of f(x).
Sample Input
31003X^5+234X^4-12X^3-2X^2+987X-1000
Sample Output
264302Notice that the writing habit of polynomial f(x) is usual such asX^6+2X^5+3X^4+4X^3+5X^2+6X+7-X^7-5X^6+3X^5-5X^4+20X^3+2X^2+3X+9X+1X^3+1X^3-X+1 etc. Any results of middle process are in the range from -1000000000 to 1000000000.
思路:一个数学的算术表达式,比较简单的,主要是注意处理头尾的,接着就是耐心打代码了。
代码如下:
- HDU 1296 (表达式求值)
- Polynomial Problem(hdu 1296 表达式求值)
- hdu 1237 简单计算器(表达式求值)
- 【表达式求值】HDU 4192
- HDU 1237 表达式求值
- 【模拟题、表达式求值】hdu hdoj 1296 Polynomial Problem
- HDU 1237 简单计算器(中缀表达式求值)
- 表达式求值(上)
- 表达式求值(中)
- 表达式求值(下)
- 四则运算(表达式求值)
- 表达式求值(char)
- 表达式求值(nyoj305)
- 表达式求值(一)
- 表达式求值(二)
- 表达式求值(nyoj305)
- 表达式求值(一)
- 表达式求值(栈)
- apache下提示undefined function mssql_connect
- 如何配置ubuntu服务器用于embedded-linux的开发
- 多线程的魔力
- UDP通讯方式及编程实现步骤
- flex3 datagrid里面checkbox实现全选功能
- HDU 1296 (表达式求值)
- mini usb耳机接口转3.5mm全过程
- SOAP和WebService的那些事
- TFixedArray
- logging模块使用
- JS 用JS实现跟随光标的提示
- 玩转Oracle(2)
- 如何在Word中用Visio画图
- 图像域重置表单