当前位置:网站首页>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;
}
边栏推荐
猜你喜欢
随机推荐
综述文章的写法
UNIX哲学
Error: Cannot find module ‘./application‘
OC-NSTimer
CentOS6.5 32bit安装Oracle-11gR2步骤说明
golang 三种指针类型具体类型的指针、unsafe.Pointer、uintptr作用
fidder为什么不会抓包的问题
Input and output of cnn
彻底理解工厂模式
UNIX Philosophy
vite的原理,手写vite
在线编译matlab,亲测好用
二进制加法
无重复字符的最长子串
How tall is the B+ tree of the MySQL index?
MATLAB中如何把cftool拟合的函数输出到命令行(解决如何导出拟合后的曲线数据)
Looper 原理浅析
threejs+shader 曲线点运动,飞线运动
七夕?程序员不存在的~
PTA习题 三角形判断