The 15th UESTC Programming Contest Preliminary D - Destr0y City cdoj1558

地址:http://acm.uestc.edu.cn/#/problem/show/1558

题目:

D - Destr0y City

Time Limit: 3000/1000MS (Java/Others)     Memory Limit: 65535/65535KB (Java/Others)

Alice want to build nn cities on a plane. A city can be regarded as a point. In order to keep communication between cities, the distance between each pair of cities must NOT greater than DD.

Bob has a weapon which can destroy all the cities in a circle with radius RR. After Alice building all the cities, Bob will select a city as the center and use his weapon once, and he will choose a way such that can destroy as many cities as possible.

To prevent the cities from being destroyed, Alice want choose a way to build her cities such that the number of cities will be destroyed by Bob can be as little as possible, can you tell her how to build these cities?

In order to make the problem easier, you can assume that D=2√RD=2R is always established, so the specific values of DD and RR will not affect the answer.

Input

Only one line contains an integer nn.

1n10181≤n≤1018.

Output

The number of cities will be destroyed by Bob if Alice choose the optimal scheme to build her cities.

Sample input and output

Sample InputSample Output
3
1

思路:找规律,猜结论

1 #include<iostream>
2 using namespace std;
3 long long n;
4 int main()
5 {
6    cin>>n;
7    cout<<n/3+!(!(n%3));
8 }

 

转载于:https://www.cnblogs.com/weeping/p/6632187.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值