1009
来源:互联网 发布:劳动力密集型产业知乎 编辑:程序博客网 时间:2024/06/16 01:05
#include<iostream>
#include<cstdio>
using namespace std;
double arr[1010] = { 0 };
double ans[2010] = { 0 };
int main_1009(){
int K;
scanf("%d", &K);
int n;
double an;
for (int i = 0; i < K; i++){
scanf("%d%lf", &n, &an);
arr[n] = an;
}
scanf("%d", &K);
for (int i = 0; i < K; i++){
scanf("%d%lf", &n, &an);
for (int j = 0; j < 1001; j++){
if (arr[j] != 0){
ans[j + n] += arr[j] * an;
}
}
}
int num = 0;
for (int i = 2000; i >= 0; i--){
if (ans[i] != 0)
num++;
}
printf("%d", num);
for (int i = 2000; i >= 0; i--){
if (ans[i] != 0)
printf(" %d %.1f", i, ans[i]);
}
return 0;
}
#include<cstdio>
using namespace std;
double arr[1010] = { 0 };
double ans[2010] = { 0 };
int main_1009(){
int K;
scanf("%d", &K);
int n;
double an;
for (int i = 0; i < K; i++){
scanf("%d%lf", &n, &an);
arr[n] = an;
}
scanf("%d", &K);
for (int i = 0; i < K; i++){
scanf("%d%lf", &n, &an);
for (int j = 0; j < 1001; j++){
if (arr[j] != 0){
ans[j + n] += arr[j] * an;
}
}
}
int num = 0;
for (int i = 2000; i >= 0; i--){
if (ans[i] != 0)
num++;
}
printf("%d", num);
for (int i = 2000; i >= 0; i--){
if (ans[i] != 0)
printf(" %d %.1f", i, ans[i]);
}
return 0;
}
1 0
- 1009
- 1009
- 1009
- 1009
- 1009
- 1009
- 1009
- 1009
- 1009
- 1009
- 1009
- 1009
- 1009
- 1009
- 1009
- 1009
- 1009
- 2004-1009
- 【软工视频】-面向过程的软件设计方法
- 矩阵低秩的意义
- ObjectAnimator简单的使用
- 第七章 程序g分析和增加控制台和吐槽
- Cocos2d-JS 2017.1.18-代码阅读笔记
- 1009
- 文件上传显示缩略图
- 快速排序(Quick Sort)
- LeetCode 463. Island Perimeter
- TCP和UDP之间的区别
- 输出datagridview到pdf
- gulpfile.js的配置
- lnmp mssql扩展
- js html 分类 下拉框