1079. Total Sales of Supply Chain (25)
来源:互联网 发布:韩国snow软件 编辑:程序博客网 时间:2024/04/30 21:09
1079. Total Sales of Supply Chain (25)
#include <iostream>#include <cmath>#include <cstdio>#include <vector>using namespace std;double sum=0.0,p,r;int n,ReAmount[100000];vector<vector<int>> v(100000);void BFS(int u){ int queue[100000],front=0,rear=0; int level=0,s,last,temp; queue[rear++]=u; last=u; while(front!=rear) { s=queue[front++]; if(v[s].size()==0) sum+=ReAmount[s]*pow((1+r/100),level)*p; for(auto it=v[s].begin();it!=v[s].end();++it) { queue[rear++]=*it; temp=*it; } if(last==s) { ++level; last=temp; } }}int main(){ cin>>n>>p>>r; for(int i=0;i<n;++i) { int k,temp; cin>>k; if(k) { while(k--) { cin>>temp; v[i].push_back(temp); } } else { cin>>temp; ReAmount[i]=temp; } } BFS(0); printf("%.1lf",sum); return 0;}
0 0
- 1079. Total Sales of Supply Chain (25)
- 1079. Total Sales of Supply Chain (25)
- 1079. Total Sales of Supply Chain (25)
- 1079. Total Sales of Supply Chain (25)
- 1079. Total Sales of Supply Chain (25)
- 1079. Total Sales of Supply Chain (25)
- 1079. Total Sales of Supply Chain (25)
- 1079. Total Sales of Supply Chain (25)
- 1079. Total Sales of Supply Chain (25)
- 1079. Total Sales of Supply Chain (25)
- 1079. Total Sales of Supply Chain (25)
- 1079. Total Sales of Supply Chain (25)
- 1079. Total Sales of Supply Chain (25)
- 1079. Total Sales of Supply Chain (25)
- 1079. Total Sales of Supply Chain (25)
- 1079. Total Sales of Supply Chain (25)
- 1079. Total Sales of Supply Chain (25)
- 1079. Total Sales of Supply Chain (25)
- 编程学习笔记之Java相关:接口(interface)的概念与使用
- 使用数字签名实现数据库记录防篡改(Java实现)
- 非对称加密算法
- redis安装
- Leetcode 67. Add Binary
- 1079. Total Sales of Supply Chain (25)
- android异常合集
- leecode 解题总结:16 3Sum Closest
- Keil Pack Installer 连接超时的解决办法
- P1020 导弹拦截
- P2668 斗地主
- Python 學習筆記系列一
- poj入门水题整理12
- 存储过程详解