当前位置:网站首页>1009 product of polynomials (25 points) [PTA class A]
1009 product of polynomials (25 points) [PTA class A]
2022-07-01 00:29:00 【Yang tree Yang tree】
#include <iostream>
#include <string.h>
using namespace std;
struct node{
int pos=0;;
double val;
}a[1100],b[1100];
//int tot=0;
double ans[5000];
int main() {
int k1,k2;cin>>k1;
// int tot;
memset(ans, 0, sizeof(ans));
for(int i=1;i<=k1;i++)
{
int c;cin>>c;
a[i].pos=c;
double va;cin>>va;
a[i].val=va;
}
cin>>k2;
for(int i=1;i<=k2;i++)
{
int c;cin>>c;
b[i].pos=c;
double va;cin>>va;
b[i].val=va;
}
for(int i=1;i<=k1;i++)
{
for(int j=1;j<=k2;j++)
{
int po=a[i].pos+b[j].pos;
ans[po]+=a[i].val*b[j].val;
}
}
int k=0;
for(int i=0;i<=2000;i++)
{
if(ans[i]!=0) k++;
}
printf("%d",k);
for(int i=2000;i>=0;i--)
{
if(ans[i]!=0)
{
printf(" %d ",i);
printf("%.1f",ans[i]);
}
}
return 0;
}边栏推荐
- Red hat will apply container load server on project atomic
- Explain kubernetes backup and recovery tools velero | learn more about carina series phase III
- left join左连接匹配数据为NULL时显示指定值
- CTF tool (1) -- archpr -- including installation / use process
- Fh6908a negative pole turn off synchronous rectification analog low voltage drop diode control IC chip tsot23-6 ultra low power rectifier 1W power consumption < 100ua static replacement mp6908
- Development of wireless U-shaped ultrasonic electric toothbrush
- The college entrance examination in 2022 is over. Does anyone really think programmers don't need to study after work?
- Bugku CTF daily one question dark cloud invitation code
- Thoughts on the future of data analysis in "miscellaneous talk"
- 2022-2028 global electric yacht industry research and trend analysis report
猜你喜欢

How to edit special effects in VR panorama? How to display detailed functions?

什么是SRM系统,如何规范公司内部采购流程

C WinForm program interface optimization example

MySQL variables, stored procedures and functions

2022-2028 global ICT test probe industry research and trend analysis report

Manage edge browser settings (ie mode, homepage binding, etc.) through group policy in the enterprise

Solving the weird problem that the query conditions affect the value of query fields in MySQL query

Combining online and offline, VR panorama is a good way to transform furniture online!

20220215 misc buctf easycap Wireshark tracks TCP flow hidden key (use of WinHex tool)

Wechat official account development (1) introduction to wechat official account
随机推荐
1175. prime number arrangement / Sword finger offer II 104 Number of permutations
What does it mean to open an account online? Is it safe to open an account online?
Rhai - rust's embedded scripting engine
2022-2028 global rotary transmission system industry research and trend analysis report
Solving the weird problem that the query conditions affect the value of query fields in MySQL query
Vulnerability discovery - App application vulnerability probe type utilization and repair
LVM snapshot: preparation of backup based on LVM snapshot
2022-2028 global capsule shell industry research and trend analysis report
1175. Disposition des nombres premiers / échange de doigts II 104. Nombre de permutations
Is it safe to open a stock account of Huatai Securities online?
8253A寄存器浅析
什么是SRM系统,如何规范公司内部采购流程
Advanced mathematical modeling
MySQL variables, stored procedures and functions
How do it outsourcing resident personnel position their pain points?
Techo youth 2022 academic year college open class: behind the live broadcast of Lianmai, explore how to apply audio and video technology
LVM snapshot: backup based on LVM snapshot
Don't worry about whether you can be a coder if you don't learn English well. Learn it first
2022-2028 global PTFE lined valve industry research and trend analysis report
Inventory the six second level capabilities of Huawei cloud gaussdb (for redis)