hdu-6154
来源:互联网 发布:剑三喵萝脸型数据 编辑:程序博客网 时间:2024/06/05 18:37
CaoHaha's staff
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 592 Accepted Submission(s): 350
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
Source
2017中国大学生程序设计竞赛 - 网络选拔赛
规律题,找最小的线段组成的面积
#include <bits/stdc++.h>using namespace std;const int MAX=90000;double num[MAX],llf=1.5,lli=4;int main(){ memset(num,0,sizeof(num)); num[4]=2; num[5]=2.5; num[6]=4; for(int i=7; i<=MAX; i++) { int y=i%4; if(y==1) { num[i]=num[i-1]+llf; llf+=1.0; } if(y==2) { num[i]=num[i-2]+lli; lli+=2.0; } if(y==3) { num[i]=num[i-1]+llf; } if(y==0) { num[i]=num[i-2]+lli; } } int T; scanf("%d",&T); while(T--) { double N; scanf("%lf",&N); for(int i=4; i<=MAX; i++) { if(num[i]>=N) { printf("%d\n",i); break; } } }}
阅读全文
0 0
- hdu 6154
- hdu-6154
- HDU 6154
- hdu
- hdu
- HDU
- hdu ()
- hdu
- hdu
- HDU
- HDU
- hdu
- hdu
- HDU
- Hdu
- hdu
- hdu-
- hdu
- CSS3 Generator在线工具
- 二叉树打印节点和为某值的全部路径
- 基于django封装的常用装饰器和函数
- 多条目加载
- MFC1-纯手写一个程序
- hdu-6154
- hdu 6152 Friend-Graph
- ADB server didn't ACK 解决方法
- JavaScript每过一段时间执行一个函数
- React初识
- Hbase学习总结一 环境部署
- Python批量修改文件名
- java算法之简单的Implement strStr
- java中常用集合