当前位置:网站首页>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;
}边栏推荐
- C WinForm program interface optimization example
- [untitled]
- [PHP] self developed framework qphp, used by qphp framework
- [designmode] factory pattern
- leetcode 474. Ones and zeroes (medium)
- "Experience" my understanding of user growth "new users"
- New trend of embedded software development: Devops
- 2022-2028 global plant peptone industry research and trend analysis report
- How to close an open DNS resolver
- $watch will not trigger data change - $watch not firing on data change
猜你喜欢

CentOS install MySQL

2022-2028 global PTFE lined valve industry research and trend analysis report

What should I do without 50W bride price

20220216 misc buuctf another world WinHex, ASCII conversion flag zip file extraction and repair if you give me three days of brightness zip to rar, Morse code waveform conversion mysterious tornado br

Which is better, server rental or hosting services in the United States?

What is SRM system and how to standardize the internal procurement process of the company

2022-2028 global rotary transmission system industry research and trend analysis report

6-1 exploit -ftp exploit

Vmware16 installing win11 virtual machine (the most complete step + stepping on the pit)

How does the VR cloud exhibition hall bring vitality to offline entities? What are the functions?
随机推荐
1175. 質數排列 / 劍指 Offer II 104. 排列的數目
Luogu p1168 median
What SQL statements are supported for data filtering
Redis - cache penetration, cache breakdown, cache avalanche
A detailed explanation of the implementation principle of go Distributed Link Tracking
CentOS install MySQL
如何关闭一个开放的DNS解析器
深入理解 Jetpack Compose 内核:SlotTable 系统
In depth understanding of jetpack compose kernel: slottable system
leetcode 474. Ones and zeroes (medium)
在指南针上买基金安全吗?
[designmode] singleton pattern
Ybtoj exchange game [tree chain splitting, line segment tree merging]
2022-2028 global rotary transmission system industry research and trend analysis report
Dataloader source code_ DataLoader
Inventory the six second level capabilities of Huawei cloud gaussdb (for redis)
File reading and writing for rust file system processing - rust Practice Guide
Software supply chain security risk pointing North for enterprise digitalization and it executives
LVM snapshot: backup based on LVM snapshot
2022-2028 global mobile scanning radiology room industry survey and trend analysis report