当前位置:网站首页>PAT1009
PAT1009
2022-08-09 11:09:00 【AlanLiu6】
https://pintia.cn/problem-sets/994805342720868352/problems/994805509540921344
#include<cstdio>
double num[1005],ans[2005];
int main()
{
int k;
scanf("%d",&k);
while(k--)
{
int x;
double y;
scanf("%d %lf",&x,&y);
num[x] = y;
}
scanf("%d",&k);
while(k--)
{
int x;
double y;
scanf("%d %lf",&x,&y);
for(int i = 0;i < 1005;i++)
{
ans[x+i] += num[i]*y;
}
}
int len = 0;
for(int i = 0;i < 2005;i++)
if(ans[i] != 0.0) len++;
printf("%d",len);
for(int i = 2005;i >=0 ;i--)
{
if(ans[i] != 0.0) printf(" %d %.1lf",i,ans[i]);
}
printf("\n");
return 0;
}
边栏推荐
猜你喜欢

fork创建多个子进程

性能测试(01)-jmeter元件-线程组、调试取样器

ThreadLocal及其内存泄露分析

激光条纹中心提取——Steger

MDK添加注释模板

x86 Exception Handling and Interrupt Mechanism (1) Overview of the source and handling of interrupts

信号量SIGCHLD的使用,如何让父进程得知子进程执行结束,如何让父进程区分多个子进程的结束

Preparation for gold three silver four: how to successfully get an Ali offer (experience + interview questions + how to prepare)
How tall is the B+ tree of the MySQL index?

wait system call
随机推荐
Beauty Values
爱可可AI前沿推介(8.9)
fidder为什么不会抓包的问题
在线编译matlab,亲测好用
golang 标准库json Marshal、Unmarshal坑
CAN总线发送数据
PAT1012
彻底理解工厂模式
sublime记录
PTA 找出不是两个数组共有的元素
【C language】typedef的使用:结构体、基本数据类型、数组
leetcode-搜索旋转排序数组-33
End-to-End Object Detection with Fully Convolutional Network学习笔记
wpf path xaml写法和c#写法对比
MDK添加注释模板
c语言函数的递归调用(汉诺塔问题,楼梯递归问题等)
1009 Product of Polynomials C语言多项式乘积(25分)
排序--快排(图解)
x86 Exception Handling and Interrupt Mechanism (1) Overview of the source and handling of interrupts
CentOS6.5 32bit安装Oracle-11gR2步骤说明