【cf】M. Game Theory(博弈水题)

19 篇文章 0 订阅

M. Game Theory

time limit per test

1 second

memory limit per test

512 megabytes

input

standard input

output

standard output

Grammy is a CS professor at Sakuya Academy and she teaches Game Theory this semester.

Including Grammy herself, there are nn people in the class. Today, in order to attract students' interest, she decides to play a game with all students.

For each student, Grammy will pick an integer xx (1≤x≤20)1≤x≤20). Without knowing what Grammy picks, the student will also pick another integer yy (1≤y≤20)1≤y≤20). In the next step, Grammy calculate the score through the following procedure with each student independently.

  • Grammy will give the student xx points.
  • The student will give Grammy yy points.
  • If Grammy's integer xx is strictly greater than yy, then she will obtain 1010 extra points from the student.
  • If Grammy's integer xx is strictly less than yy, then she will give 1010 extra points to the student.

Now Grammy wants to know the expected amount of points she may win from all students if she chooses to pick the integer randomly and independently, which means for all integers in [1,20][1,20], they all share the same possibility. Since students are very clever, you may assume that they will follow the optimal strategy in this game to maximize their final score.

Note that during the game, if one gives out points, he will lose the same amount of points. Moreover, the total point one obtains can be negative.

Input

The input contains only a single case.

The only line of the input contains an integer nn (1≤n≤10001≤n≤1000), indicating the total number of people in the class (Including Grammy).

Output

Output the answer in one line. Your answer will be considered correct if and only if the absolute or relative error does not exceed 10−410−4.

Example

input

Copy

1

output

Copy

0.0000

题目大意:就是老师面对n个学生,老师对每个学生给出一个数x,学生在不知道老师给出的数是多少的情况下,给出一个数y,数x,y都是大于等于0小于等于20的x>y老师从学生那里得到十分,反之,x<y学生从老师那里得到十分,最后让你输出老师的得分

解题思路:很明显是一道博弈论的题目,谁都不想让自己的得分少,所以不管是老师还是学生都会选择最大的数20,因为只有给出20是不可能失分的,就这样就会造成一个奇异,就是最后大家平手,最后得分都是0

下面附上ac代码

#include <iostream>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <set>
#include <map>
#define dbg(a)  cout<<#a<<" : "<<a<<endl;
using namespace std;
typedef long long ll;
ll a[1000010];
ll vis[1000010];
map<ll,ll> ss;
int main()
{
    std::ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);
    ll n;
    cin>>n;
    cout<<0.0000<<endl;
    return 0;
}

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值