1009. Product of Polynomials
来源:互联网 发布:域名查询和注册软件 编辑:程序博客网 时间:2024/05/22 07:07
Tips:
- 本题与1002类似,只不过此题是求乘积,但和1002注意的地方一样.
- 还需注意的是,本题开辟的数组空间大小应为2001.
#include <iostream>using namespace std;#define LEN 2001int main() { int k1,k2,i,j,count; int *pCoe; double *pIndex; int coe; double index; double *result = new double[LEN]; for(i = 0;i <LEN;i ++) result[i] = 0; while(scanf("%d",&k1) != EOF) { count = 0; pCoe = new int[k1]; pIndex = new double[k1]; for(i = 0;i < k1;i ++) scanf("%d %lf",&pCoe[i],&pIndex[i]); scanf("%d",&k2); for(i = 0;i < k2;i ++){ scanf("%d %lf",&coe,&index); for(j = 0;j < k1;j ++){ if(result[coe + pCoe[j]] == 0) count ++; result[coe + pCoe[j]] += index * pIndex[j]; if(result[coe + pCoe[j]] == 0) count --; } } printf("%d",count); for(i = LEN - 1;i >= 0;i --){ if(result[i] != 0){ printf(" %d %.1lf",i,result[i]); result[i] = 0; } } printf("\n"); } return 0;}
0 0
- 1009. Product of Polynomials
- 1009. Product of Polynomials
- 1009. Product of Polynomials
- 1009.Product of Polynomials
- 1009. Product of Polynomials
- 1009. Product of Polynomials
- 1009. Product of Polynomials
- 1009. Product of Polynomials
- 1009. Product of Polynomials
- 1009. Product of Polynomials
- 1009. Product of Polynomials
- 1009. Product of Polynomials (25)
- 【PAT】1009. Product of Polynomials
- 1009. Product of Polynomials (25)
- 1009. Product of Polynomials (25)
- 1009. Product of Polynomials (25)
- 1009. Product of Polynomials (25)
- 1009. Product of Polynomials (25)
- 取消显示 Actionbar
- [BZOJ1651] [Usaco2006 Feb]Stall Reservations 专用牛棚
- 黑马程序员——反射
- iOS开发流程总结
- 内蒙古大学教务处脱表名脚本
- 1009. Product of Polynomials
- 10大iOS开发者最喜爱的库
- 最大公约数(更相减损法)
- 企业领袖必读的10本管理学书籍
- 1011. World Cup Betting
- ​5.5.xx MySQL 编译安装
- Android中静态变量的生命周期
- CMMI(软件能力成熟度模型集成)名词术语整理
- CSS中margin和padding的区别