数学联邦政治世界观
超小超大

数学(一)

void solve()

{

mt19937 rng;

int sum=0;

for (int i = 0; i<100000; ++i) {

int x, y, r;

x = rng() % 199 - 99;

y = rng() % 199 - 99;

do

{

r= rng() % 199 - 99;

}while(x+r>100||x-r<-100||y+r>100||y-r<-100);

sum+=abs(x)+abs(y);

}

cout<<sum;

}

第二个是

void solve()

{

mt19937 rng;

int sum=0;

for (int i = 0; i<100000; ++i) {

int x, y, r;

do{

x = rng() % 199 - 99;

y = rng() % 199 - 99;

r= rng() % 199 - 99;

}while(x+r>100||x-r<-100||y+r>100||y-r<-100);

sum+=abs(x)+abs(y);

}

cout<<sum;

}

通过观察sum可得第个方法普遍大于90*n;

这是jiangly的方法和代码

include:<bits/stdc++.h>

using i64 = long long;

int main() {

std::ios::sync_with_stdio(false);

std::cin.tie(nullptr);

int n;

std::cin>>n;

int sum = 0;

for (int i = 0; i < n; i++) {

int x, y, r;

std::cin>>x>>y>>r;

sum += std::abs(x) + std::abs(y);

}

if (sum>90 * n) {

std::cout<<"bit-noob\n";

} else {

std::cout<<"buaa-noob\n";

}

return 0;

}

不过还有一种就是观察两个人的方法,概率分析,第一种方法是圆心概率一定 第二种是半径概率一定。因此第一个人的圆心位置概率更平均。也就是说,第一种方法取到偏远地方(max(abs(x),abs(y))大于95)的概率更大。平均取数的话,第一种取到大于95的概率大概有1/20,在1e5的数字范围内大约有5000次能取到,我试了一下,5000确实是对的,不过保险起见,这个阈值还是不要取临界.

#include<bits/stdc++.h>

define:endl '\n'

using namespace std;

typedef long long LL;

typedef pair<int,int>PII;

const int N = 1e6+10, M = 30010;

void solve()

{

// cout<<setiosflags(ios::fixed)<<setprecision(10);

int n;

cin>>n;

int cnt = 0;

for(int i = 0; i<n ;i++)

{

int x, y, r;

cin>>x>>y>>r;

if(max(abs(x),abs(y)) >= 95) cnt++;

}

if(cnt >= 3000) cout<<"bit-noob"<<endl;

else cout<<"buaa-noob"<<endl;

}

int main()

{

ios::sync_with_stdio(0);

cin.tie(0);

int T = 1;

while (T--)

{

solve();

}

return 0;

}

数学联邦政治世界观提示您:看后求收藏(笔尖小说网http://www.bjxsw.cc),接着再看更方便。

相关小说

喜美:朦胧梦境 连载中
喜美:朦胧梦境
湫日有棂
禁一切作者:湫日有棂【祈念文学社】从学生时期便认识的我们,为什么最后没能走到一起?一场意外把美幻曦带到副本世界,需要前往一个个世界攻略喜易言......
14.7万字11个月前
快穿:娇软万人迷 连载中
快穿:娇软万人迷
江鱼不是鱼
全员单箭头,一见钟情梗,万人迷,脑子寄存—
4.9万字10个月前
巷往巷往 连载中
巷往巷往
139***084_7062947698
1.5万字7个月前
生活里的生活 连载中
生活里的生活
大森林狂想曲
未来的潮流趋势,谁也不知道,科技是永恒的话题
6.4万字7个月前
重生之我在药店打工 连载中
重生之我在药店打工
爱幻想家
《重生之我在药店打工》简介林小满,一个平凡的药店打工妹,每日忙碌于药架与收银台之间,生活波澜不惊,却因一场突如其来的医疗事故,命运被彻底改写......
1.7万字3个月前
绝命区404 连载中
绝命区404
卑微洛某人
据说,在学校有一个传闻……传闻,在后山的一条公路上的山壁上有一些不起眼的石块,但实际上,这是一处名叫“绝命区404”的古遗迹,只要解开迷题就......
3.6万字2个月前