1009. Product of Polynomials (25)
#include <stdio.h> struct MyStruct
{
int exp;
double coe;
}; int main()
{
int k1,k2,i,j;
MyStruct ans1[],ans2[];
double dans[]; //两个 最高幂相乘 , 最高幂为2000
while(scanf("%d",&k1)!=EOF)
{
for(i=;i<=;i++)
dans[i]=0.0;
for(i=;i<k1;i++)
scanf("%d%lf",&ans1[i].exp,&ans1[i].coe);
getchar();
scanf("%d",&k2);
for(i=;i<k2;i++)
scanf("%d%lf",&ans2[i].exp,&ans2[i].coe);
int count=;
for(i=;i<k1;i++)
for(j=;j<k2;j++)
{
if(dans[ans1[i].exp+ans2[j].exp]==0.0) ++count;
dans[ans1[i].exp+ans2[j].exp]+=(ans1[i].coe * ans2[j].coe);
if(dans[ans1[i].exp+ans2[j].exp]==0.0) --count;
} printf("%d",count);
for(i=;i>=;i--)
if(dans[i]!=0.0)
printf(" %d %0.1lf",i,dans[i]);
printf("\n");
}
return ;
}
1009. Product of Polynomials (25)的更多相关文章
- PAT甲 1009. Product of Polynomials (25) 2016-09-09 23:02 96人阅读 评论(0) 收藏
1009. Product of Polynomials (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yu ...
- PAT 甲级 1009 Product of Polynomials (25)(25 分)(坑比较多,a可能很大,a也有可能是负数,回头再看看)
1009 Product of Polynomials (25)(25 分) This time, you are supposed to find A*B where A and B are two ...
- pat 甲级 1009. Product of Polynomials (25)
1009. Product of Polynomials (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yu ...
- PATA 1009. Product of Polynomials (25)
1009. Product of Polynomials (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yu ...
- 1009 Product of Polynomials (25分) 多项式乘法
1009 Product of Polynomials (25分) This time, you are supposed to find A×B where A and B are two po ...
- PAT 1009 Product of Polynomials (25分) 指数做数组下标,系数做值
题目 This time, you are supposed to find A×B where A and B are two polynomials. Input Specification: E ...
- 【PAT】1009. Product of Polynomials (25)
题目链接:http://pat.zju.edu.cn/contests/pat-a-practise/1009 分析:简单题.相乘时指数相加,系数相乘即可,输出时按指数从高到低的顺序.注意点:多项式相 ...
- PAT 解题报告 1009. Product of Polynomials (25)
This time, you are supposed to find A*B where A and B are two polynomials. Input Specification: Each ...
- 1009 Product of Polynomials (25)(25 point(s))
problem This time, you are supposed to find A*B where A and B are two polynomials. Input Specificati ...
- PAT Advanced 1009 Product of Polynomials (25 分)(vector删除元素用的是erase)
This time, you are supposed to find A×B where A and B are two polynomials. Input Specification: Each ...
随机推荐
- 修改Linux网卡由eth1变成eth0
正常来说,Linux在识别网卡时第一张会是eth0,第二张才是eth1.有时候我们使用虚拟机克隆技术后网卡的信息就会改变,新克隆出来的虚拟主机网卡名字可能变为eth1.无论我们怎么修改都无法改变,这就 ...
- gitlab ce 中删除空项目之后,没有删除掉,访问500
在VirtualBox中的gitlab ce,在管理页面的操作如下: 新建一个仓库名为test的仓库,并从gitlab中导入 导入失败,使用root用户登录,在 Admin Area -> Pr ...
- Jersey(1.19.1) - Conditional GETs and Returning 304 (Not Modified) Responses
Conditional GETs are a great way to reduce bandwidth, and potentially server-side performance, depen ...
- 使用spring+hibernate+atomikos+tomcat构建分布式事务
本文通过一个demo,介绍如何使用spring+hibernate+atomikos+tomcat构建在一个事务中涉及两个数据源的web应用. demo功能:实现一个能成功提交和回滚的涉及两个数据库数 ...
- 最新app源码下载:200款优秀Android项目源码
200款优秀Android项目源码!菜鸟必备!Android开发又将带来新一轮热潮,很多开发者都投入到这个浪潮中去了,创造了许许多多相当优秀的应用.其中也有许许多多的开发者提供了应用开源项目,贡献出他 ...
- ContentProvider(一)
注册ContentProvider: <provider android:name=".provider.UserProvider" android:authorities= ...
- jQuery选项卡插件、Tabs插件
效果图: <!DOCTYPE html> <html> <head> <title></title> <script src=&quo ...
- ORACLE多表查询优化
ORACLE有个高速缓冲的概念,这个高速缓冲就是存放执行过的SQL语句,那oracle在执行sql语句的时候要做很多工作,例如解析sql语句,估算索引利用率,绑定变量,读取数据块等等这些操作.假设高速 ...
- Swift标识符和关键字
任何一种计算机语言都离不开标识符和关键字,下面我们将详细介绍Swift标识符和关键字. 标示符 标识符就是给变量.常量.方法.函数.枚举.结构体.类.协议等指定的名字.构成标识符的字母均有一定的规范, ...
- UIView-4-EventForViews(在view上加入button时候的事件处理)
#import "ViewController.h" @interface ViewController () @end @implementation ViewControlle ...