// ConsoleApplication12.cpp : 定义控制台应用程序的入口点。

//

#include "stdafx.h"
// ConsoleApplication12.cpp : 定义控制台应用程序的入口点。
// #include <iostream>
#include <vector> using namespace std; int main()
{
int W, N;
// int Y;
long float Y;
long float x;
while (cin>>W>>Y>>x>>N)
{ while (N!=0)
{
Y =( W*(1 - x)*(Y + 1) + (x*W*21))/W;
N--;
} int y = Y ; if (y == Y)
{
cout << y << endl;
}
else {
cout << y + 1 << endl;
} } return 0;
};

已知某公司总人数为W,平均年龄为Y岁(每年3月末计算,同时每年3月初入职新人),假设每年离职率为x,x>0&&x<1,每年保持所有员工总数不变进行招聘,新员工平均年龄21岁。 从今年3月末开始,请实现一个算法,可以计算出第N年后公司员工的平均年龄。(最后结果向上取整)。的更多相关文章

  1. Sql 获取向上取整、向下取整、四舍五入取整的实例

    [四舍五入取整截取] select round(54.56,0) [向下取整截取] SELECT FLOOR(54.56) [向上取整截取]  SELECT   CEILING(13.15) --MS ...

  2. js只保留整数,向上取整,四舍五入,向下取整等函数

    1.丢弃小数部分,保留整数部分 parseInt(5/2) 2.向上取整,有小数就整数部分加1 Math.ceil(5/2) 3.四舍五入. Math.round(5/2) 4.向下取整 Math.f ...

  3. SQLSERVER 数值 四舍五入取整 向上取整 向下取整

    [四舍五入取整截取] select round(54.56,0) [向下取整截取] SELECT floor(54.56) [向上取整截取]  SELECT   ceiling(13.15)

  4. SQL 向上取整、向下取整、四舍五入取整的实例!round、rounddown、roundup

    sql server ==================================================== [四舍五入取整截取] select round(54.56,0) === ...

  5. python 向上取整ceil 向下取整floor 四舍五入round

    #encoding:utf-8 import math #向上取整 http://www.manongjc.com/article/1335.html print "math.ceil--- ...

  6. Sql Server 里的向上取整、向下取整、四舍五入取整

    ==================================================== [四舍五入取整截取] select round(54.56,0) ============== ...

  7. Python 向上取整的算法

    一.初衷: 有时候我们分页展示数据的时候,需要计算页数.一般都是向上取整,例如counts=205 pageCouts=20 ,pages= 11 页. 一般的除法只是取整数部分,达不到要求. 二.方 ...

  8. DIV_ROUND_UP(x,y)实现x/y向上取整

    #define DIV_ROUND_UP(x,y) (((x) + ((y) - 1)) / (y)) 1.问题 x.y都是整数,且x > 1, y > 1,求 x / y的向上取整,即: ...

  9. Sql Server 里的向上取整、向下取整、四舍五入取整的实例!

    http://blog.csdn.net/dxnn520/article/details/8454132 =============================================== ...

随机推荐

  1. POJ1671 Rhyme Schemes

    Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 1776   Accepted: 984   Special Judge De ...

  2. 延迟加载技术 jquery lazyload

    原文发布时间为:2011-01-17 -- 来源于本人的百度文章 [由搬家工具导入]  文章: http://www.appelsiini.net/projects/lazyload 下载地址:htt ...

  3. configurationmanager.getsection usage example.

    1.app.config(note that attribute case sensitive!) <?xml version="1.0" encoding="ut ...

  4. ckeditor编辑的使用方法

    一.下载安装Ckeditor,并将其整合到项目中 1.什么是CKeditor?为什么要使用它? 我们在做门户网站或者公文系统时,客户经常要求在录入时能够更改字体样式.大小.颜色并具备插入图片的功能.而 ...

  5. 气象城市ID列表

    气象城市ID列表 数据来源: http://cj.weather.com.cn/support/Detail.aspx?id=51837fba1b35fe0f8411b6df 记录了2574个地区,2 ...

  6. Python连接MySQL数据库操作

    一.创建数据库及表 CREATE DATABASE testdb; USE testdb; CREATE TABLE `tb_user` ( `id` INT (11) NOT NULL AUTO_I ...

  7. [LeetCode] Convert Sorted List to Binary Search Tree DFS,深度搜索

    Given a singly linked list where elements are sorted in ascending order, convert it to a height bala ...

  8. 《Linux命令行与shell脚本编程大全 第3版》Linux命令行---47

    以下为阅读<Linux命令行与shell脚本编程大全 第3版>的读书笔记,为了方便记录,特地与书的内容保持同步,特意做成一节一次随笔,特记录如下:

  9. java 基于tcp客户端服务端发送接收数据

    客户端: package demo03; import java.io.IOException; import java.io.InputStream; import java.io.OutputSt ...

  10. Win7下VS2010、IIS7配置常见问题收集

    一 在Win7下应按什么次序安装vs2010和iis7 win7推荐先安装iis7,再安装vs2010:如果次序反了,必须注册iis才可以用. IIS中ASP.NET的版本号此时可选的有1.1.2.0 ...