首页 > 其他 > 详细

bzoj3098 Hash Killer II

时间:2017-04-29 18:38:54      阅读:209      评论:0      收藏:0      [点我收藏+]

传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=3098

【题解】

生日问题:如果在[1,n]中选数,那么平均根号n次就能选到重复的。

那么直接随机即可。

注意l不能太小也不能太大,取20左右即可。

技术分享
# include <stdio.h>
# include <string.h>
# include <algorithm>
// # include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
const int M = 5e5 + 10;
const int mod = 1e9+7;

# define RG register
# define ST static

int n = 100000, l = 20;

int main() {
    printf("%d %d\n", n, l);
    for (int i=1; i<=n; ++i) 
        printf("%c", (char)(rand()%26+a));
    return 0;
}
View Code

 

bzoj3098 Hash Killer II

原文:http://www.cnblogs.com/galaxies/p/bzoj3098.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!