zoukankan      html  css  js  c++  java
  • 某道我xjb想的题

                                    Function

    时限:5s

    空限:256M

    (都是单点)

    Discription

    现在你有一个函数:

    inline int f(int x){
    	int tot=0,alr=0,now;
    	while(alr<x){
    		now=rand()%x+1;
    		tot++;
    		if(!v[now]) alr++,v[now]=1;
    	}
    	return tot;
    }
    

    其中v可以被看成是一个无限大的每一个位置初始值都为0的数组。

    对于一个给定的n,大(shen)葱想知道 f(n) 的期望是多少。

    但是这个问题太简单了,于是他把它丢给了你。

    Input

    一行一个整数N。

    Output

    一行一个数,表示 f(N) 的期望,精确到整数。

    Example

    #1.in:

    10

    #1.out:

    29

    Hint

    对于20%的数据,N<=100;

    对于40%的数据,N<=1000;

    对于60%的数据,N<=300000;

    对于80%的数据,N<=10000000;

    对于100%的数据,N<=1000000000。

  • 相关阅读:
    SKPhysicsJointPin类
    SKPhysicsJointLimit类
    SKPhysicsJointFixed类
    SKPhysicsJoint类
    SKPhysicsContact类
    SKPhysicsBody类
    SKLabelNode类
    SKNode类
    SKKeyframeSequence类
    Unique Paths II
  • 原文地址:https://www.cnblogs.com/JYYHH/p/8418156.html
Copyright © 2011-2022 走看看