当前位置:网站首页>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;
}
边栏推荐
猜你喜欢
随机推荐
链表基本操作(详解)
学习阶段总结(背包问题)
Open3D 点云平均点间距评估
PTA习题 阶梯电价(C)
去除蜂窝状的噪声(matlab实现)
C语言统计不同单词数
prometheus接入mysqld_exporter
1006 Sign In and Sign Out (25分)
grpc系列-初探grpc 路由注册和转发实现
ICML 2022 | Out-of-Distribution Detection with Deep Nearest Neighbors
enum in c language
golang源代码阅读,sync系列-Map
Product Quantization (PQ)
x86 Exception Handling and Interrupt Mechanism (3) Interrupt Handling Process
Solve 1. tensorflow runs using CPU but not GPU 2. GPU version number in tensorflow environment 3. Correspondence between tensorflow and cuda and cudnn versions 4. Check cuda and cudnn versions
七夕?程序员不存在的~
MATLAB中如何把cftool拟合的函数输出到命令行(解决如何导出拟合后的曲线数据)
Qt获取EXE可执行文件的上一级目录下的文件
杂记(6)
PAT1012









