UVa 498 - Polly the Polynomial
2014-10-29 17:33
337 查看
题目:一直多项式的系数,求不同的x对应多项式的值。
分析:数学题,简单题。直接代入多项式计算即可。
说明:注意输入格式。
分析:数学题,简单题。直接代入多项式计算即可。
说明:注意输入格式。
#include <iostream> #include <cstdlib> #include <cstring> #include <cstdio> using namespace std; int temp,c[10000]; int main() { int n; while ((temp = getchar()) != EOF) { int count = 0; while (temp != '\n') { if (temp == '-' || temp >= '0' && temp <= '9') { ungetc(temp, stdin); scanf("%d",&c[count ++]); } temp = getchar(); } int flag = 0,data,sum; temp = getchar(); while (temp != '\n') { if (temp == '-' || temp >= '0' && temp <= '9') { ungetc(temp, stdin); scanf("%d",&data); sum = 0; for (int i = 0 ; i < count ; ++ i) { sum *= data; sum += c[i]; } if (flag) printf(" "); printf("%d",sum); flag = 1; } temp = getchar(); } printf("\n"); } return 0; }
相关文章推荐
- UVa 498 - Polly the Polynomial
- uva 498 - Polly the Polynomial
- 1280: Polly the Polynomial
- UVa10326 - The Polynomial Equation
- 1280: Polly the Polynomial
- (beginer) 半平面交 UVA 11265 The Sultan's Problem
- UVA 1640 The Counting Problem UVA1640 求[a,b]或者[b,a]区间内0~9在里面各个数的数位上出现的总次数。
- uva 10256 The Great Divide (Convex Hull, Simple)
- UVa 357 Let Me Count The Ways (完全背包)
- hdu 1032 && uva 100 The 3n + 1 problem
- uva 484 - The Department of Redundancy Department
- UVA 10878 Decode the tape
- uva 10054 - The Necklace
- uva 101 - The Blocks Problem
- UVa 10812 - Beat the Spread!
- UVA 10564 Paths through the Hourglass
- UVA 1025 A Spy in the Metro(dp)
- UVa 10066 - The Twin Towers
- UVALive 6465 Islands in the Data Stream 暴力模拟
- uva 1364 - Knights of the Round Table(二分图+强连通)