1009 Product of Polynomials (25分) 晚上脑子就是容易僵住
#include<iostream>
using namespace std;
struct {
int a;
double b;
}poly[1001];
double a[2001];//至少2000个位置
int main(){
int n,m,cnt=0,aa;
double bb;
cin>>n;
for(int i=0;i<n;i++){
cin>>poly[i].a>>poly[i].b;
}
cin>>m;
for(int i=0;i<m;i++){
int aa;
double bb;
cin>>aa>>bb;
for(int j=0;j<n;j++){
a[poly[j].a+aa]+=poly[j].b*bb; //这句蛮灵性的 ,仅此
}
}
for(int i=0;i<=2000;i++)
if(a[i]!=0)cnt++;
cout<<cnt;
for(int i=2000;i>=0;i--){
if(a[i]!=0){
printf(" %d %.1f",i,a[i]);
}
}
}

1009 Product of Polynomials (25分) 晚上脑子就是容易僵住的更多相关文章
- 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 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 ...
- 【PAT甲级】1009 Product of Polynomials (25 分)
题意: 给出两个多项式,计算两个多项式的积,并以指数从大到小输出多项式的指数个数,指数和系数. trick: 这道题数据未知,导致测试的时候发现不了问题所在. 用set统计非零项时,通过set.siz ...
- 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) 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)
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 ...
- 【PAT】1009. Product of Polynomials (25)
题目链接:http://pat.zju.edu.cn/contests/pat-a-practise/1009 分析:简单题.相乘时指数相加,系数相乘即可,输出时按指数从高到低的顺序.注意点:多项式相 ...
随机推荐
- Vue Element-ui表单校验规则,你掌握了哪些?
1.前言 Element-ui表单校验规则,使得错误提示可以直接在form-item下面显示,无需弹出框,因此还是很好用的. 我在做了登录页面的表单校验后,一度以为我已经很了解表单的校验规则. ...
- Linux:CentOS-7配置VMware-15.5与本机IP同网段
确认本机IP ctrl+R:输入cmd 回车 输入命令:ipconfig 可以看出一下信息:本机ip: 192.168.1.162网关:192.168.1.1DNS服务器:192.168.1.1 设 ...
- Elasticsearch-02-入门:集群、节点、分片、索引及常用API
2. 基础入门 2.1 重要概念 2.1.1 集群和节点 1)cluster Elasticsearch集群是由一个或多个节点组成,通过其集群名称来进行唯一标识.节点在搜索到集群之后,通过判断自身的 ...
- Android控件总结
最常用的控件:TextView.EditText.Button.ImageView TextView 文本 ...
- Flask(12)- 操作 Session
前言 Session 详解:https://www.cnblogs.com/poloyy/p/12513247.html 这一节来瞧一瞧如何用 Flask 操作 Session 功能 list 提供操 ...
- kali2020安装中文界面
1.安装中文字体:apt-get install xfonts-intl-chinese ttf-wqy-microhei 2.设置系统语言:dpkg-reconfigure locales 3.选择 ...
- C语言:char讲解与例子
#include <stdio.h> main() { char bla,blb,blc;//声明或定义三个字符型变量,变量名为bla,blb,blc //字符型数据用标识符char来标识 ...
- ADB打开快手APP
aa="adb -s {0} shell am start -n com.kuaishou.nebula/com.yxcorp.gifshow.HomeActivity".form ...
- ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: NO)解决办法
问题:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) 很久没用这台电脑的mysql ...
- Leetcode4. 寻找两个正序数组的中位数
> 简洁易懂讲清原理,讲不清你来打我~ 输入两个递增数组,输出中位数![在这里插入图片描述](https://img-blog.csdnimg.cn/25550994642144228e9862 ...