博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
1079. Total Sales of Supply Chain (25)
阅读量:4071 次
发布时间:2019-05-25

本文共 727 字,大约阅读时间需要 2 分钟。

传送门:

AC代码

#include 
#include
#include
#include
#include
#include
using namespace std;struct Node{ Node *parent; int num,level; Node():num(0),level(-1),parent(NULL){};};void init(Node * T){ if(T->level==-1){ if(T->parent==NULL) T->level = 0; else { if(T->parent->level==-1) init(T->parent); T->level = T->parent->level+1; } }}int main(){ int n,m,t; double price,rate; scanf("%d %lf %lf",&n,&price,&rate); vector
tree; for (int i=0; i
num=-1; for (int j=0; j
parent = tree[i]; } }else scanf("%d",&tree[i]->num); } for (int i=0; i
num!=-1){ int x = tree[i]->level; totalPrice += price * pow((1+0.01*rate),x) * tree[i]->num; } } printf("%.1lf\n",totalPrice); return 0;}

转载地址:http://aqhji.baihongyu.com/

你可能感兴趣的文章
《计算机网络》第五章 运输层 ——TCP和UDP 可靠传输原理 TCP流量控制 拥塞控制 连接管理
查看>>
堆排序完整版,含注释
查看>>
二叉树深度优先遍历和广度优先遍历
查看>>
生产者消费者模型,循环队列实现
查看>>
PostgreSQL代码分析,查询优化部分,process_duplicate_ors
查看>>
PostgreSQL代码分析,查询优化部分,canonicalize_qual
查看>>
PostgreSQL代码分析,查询优化部分,pull_ands()和pull_ors()
查看>>
ORACLE权限管理调研笔记
查看>>
移进规约冲突一例
查看>>
IA32时钟周期的一些内容
查看>>
SM2椭圆曲线公钥密码算法
查看>>
获得github工程中的一个文件夹的方法
查看>>
《PostgreSQL技术内幕:查询优化深度探索》养成记
查看>>
PostgreSQL查询优化器详解之逻辑优化篇
查看>>
STM32中assert_param的使用
查看>>
C语言中的 (void*)0 与 (void)0
查看>>
vu 是什么
查看>>
io口的作用
查看>>
IO口的作用
查看>>
UIView的使用setNeedsDisplay
查看>>