hdu-CaoHaha's staff
来源:互联网 发布:集合与数组的联系 编辑:程序博客网 时间:2024/05/16 08:46
CaoHaha's staff
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2089 Accepted Submission(s): 818
Statistic | Submit | Clarifications | Back
Problem Description
"You shall not pass!"
After shouted out that,the Force Staff appered in CaoHaha's hand.
As we all know,the Force Staff is a staff with infinity power.If you can use it skillful,it may help you to do whatever you want.
But now,his new owner,CaoHaha,is a sorcerers apprentice.He can only use that staff to send things to other place.
Today,Dreamwyy come to CaoHaha.Requesting him send a toy to his new girl friend.It was so far that Dreamwyy can only resort to CaoHaha.
The first step to send something is draw a Magic array on a Magic place.The magic place looks like a coordinate system,and each time you can draw a segments either on cell sides or on cell diagonals.In additional,you need 1 minutes to draw a segments.
If you want to send something ,you need to draw a Magic array which is not smaller than the that.You can make it any deformation,so what really matters is the size of the object.
CaoHaha want to help dreamwyy but his time is valuable(to learn to be just like you),so he want to draw least segments.However,because of his bad math,he needs your help.
After shouted out that,the Force Staff appered in CaoHaha's hand.
As we all know,the Force Staff is a staff with infinity power.If you can use it skillful,it may help you to do whatever you want.
But now,his new owner,CaoHaha,is a sorcerers apprentice.He can only use that staff to send things to other place.
Today,Dreamwyy come to CaoHaha.Requesting him send a toy to his new girl friend.It was so far that Dreamwyy can only resort to CaoHaha.
The first step to send something is draw a Magic array on a Magic place.The magic place looks like a coordinate system,and each time you can draw a segments either on cell sides or on cell diagonals.In additional,you need 1 minutes to draw a segments.
If you want to send something ,you need to draw a Magic array which is not smaller than the that.You can make it any deformation,so what really matters is the size of the object.
CaoHaha want to help dreamwyy but his time is valuable(to learn to be just like you),so he want to draw least segments.However,because of his bad math,he needs your help.
Input
The first line contains one integer T(T<=300).The number of toys.
Then T lines each contains one intetger S.The size of the toy(N<=1e9).
Then T lines each contains one intetger S.The size of the toy(N<=1e9).
Output
Out put T integer in each line ,the least time CaoHaha can send the toy.
Sample Input
512345
Sample Output
44667
#include<cstdio>#include<cstring>#include<cmath>#include<iostream>#include<algorithm>#include<queue>using namespace std;double a[500010];int main(){ a[0]=0;a[1]=0;a[2]=0;a[3]=0; for(int i=4;i<=100000;i++){ if(i%2==0){ int k=i%4; k=k/2; a[i]=(int)2*(i/4)*(i/4+k); } else{ int k=(i-1)%4; k=k/2; a[i]=(int)a[i-1]+(int)((i-1)/4+k-0.5); } } int t; scanf("%d",&t); while(t--){ long long n,x; scanf("%lld",&n); x=lower_bound(a,a+100000,n)-a; printf("%lld\n",x); }}
阅读全文
0 0
- hdu-CaoHaha's staff
- HDU 6154 CaoHaha's staff
- Hdu 6154 CaoHaha's staff
- HDU 6154 CaoHaha's staff
- HDU 6154 CaoHaha's staff
- HDU 6154 CaoHaha's staff
- hdu 6154 CaoHaha's staff
- hdu 6154 CaoHaha's staff
- hdu-6156 CaoHaha's staff
- HDU 6154 CaoHaha's staff
- HDU 6154 CaoHaha's staff
- HDU 6154 CaoHaha's staff 找规律
- HDU 6154-CaoHaha's staff(ccpc)
- HDU CCPC 1005 CaoHaha's staff
- HDU 6154 CaoHaha's staff(规律)
- Hdu 6154 CaoHaha's staff【思维】
- HDU 6154 CaoHaha's staff【找规律】
- HDU 6154 CaoHaha's staff 找规律
- Java-锤子剪刀布 (20)
- 2.0剑指offer书籍的学习
- css3纵向滚屏翻页,支持键盘,鼠标操作
- 构造函数与析构函数的典型应用
- 最长上升序列(Lis)
- hdu-CaoHaha's staff
- 马赛克算法
- java面试题:字符串的反转
- 编程之美
- 指纹辨识不再安全?苹果安全处理器出现漏洞?
- springBoot接收date类型参数转换
- SSIS--如何在 ETL 项目中统一管理上百个 SSIS 包的日志和包配置框架
- PreferenceScreen使用
- HDU 6153 A Secret(扩展KMP算法)