玲珑杯 Round #11 (1001 1004 1007)
直接贴代码。。
#include<bits/stdc++.h>
using namespace std;
typedef long long LL; int main()
{
LL a,b,n;
while(cin>>a>>b>>n)
{
LL sum=1e18;
LL ans;
for(LL i=;i*i<=n;i++) if(n%i==)
{
LL t=a*n/i+b*n*i;
if(t<sum)
{
sum=t;
ans=i;
}
}
cout<<ans<<endl;
}
}
1001
#include<bits/stdc++.h>
using namespace std;
typedef long long LL; LL x;
int vis[];
int yes[];
int ans[]={,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,}; void init()
{
for(int i=;ans[i]<;i++)
yes[ans[i]]=;
} LL cal(LL x)
{
LL ret=;
while(x)
{
ret+=(x%)*(x%);
x/=;
}
return ret;
} bool ok(LL x)
{
if(x<&&yes[x]==)
{
return true;
}
if(x<&&vis[x]) return ;
if(x<) vis[x]=;
return ok(cal(x));
} int main()
{
init();
while(cin>>x)
{
memset(vis,,sizeof(vis));
if(ok(x))
puts("YES");
else
puts("NO");
}
}
1004
#include<bits/stdc++.h>
using namespace std;
typedef long long LL; long double x0,y0,x1,y1,v,vx,vy; //用double wa了。。 struct point
{
long double x,y;
long double operator *(const point &rhs)const
{
return x*rhs.x+y*rhs.y;
}
}p0,p1,v0,p; long double dist(point p)
{
return sqrt(p.x*p.x+p.y*p.y);
} int main()
{
int T;
cin>>T;
while(T--)
{
cin>>p0.x>>p0.y;
cin>>p1.x>>p1.y;
cin>>v0.x>>v0.y;
cin>>v;
p.x=p1.x-p0.x,p.y=p1.y-p0.y;
long double v0_l=dist(v0);
long double p_l=dist(p); if(v0*p<=)
{
if(v>v0_l)
puts("YES");
else
puts("NO");
}
else
{
long double v_in_d=v0*p/p_l;
if(dist(v0)*dist(v0)-(v_in_d*v_in_d)<=v*v)
puts("YES");
else
puts("NO");
}
}
}
1007
玲珑杯 Round #11 (1001 1004 1007)的更多相关文章
- Codeforces Round #270 1001
Codeforces Round #270 1001 A. Design Tutorial: Learn from Math time limit per test 1 second memory l ...
- 贪心 BestCoder Round #39 1001 Delete
题目传送门 /* 贪心水题:找出出现次数>1的次数和res,如果要减去的比res小,那么总的不同的数字tot不会少: 否则再在tot里减去多余的即为答案 用set容器也可以做,思路一样 */ # ...
- int和integer;Math.round(11.5)和Math.round(-11.5)
int是java提供的8种原始数据类型之一.Java为每个原始类型提供了封装类,Integer是java为int提供的封装类.int的默认值为0,而Integer的默认值为null,即Integer可 ...
- Math.round(11.5)等于()Math.round(-11.5)等于()
几天前去面试,这道简单的题目居然做错了,看来基础就是慢慢积累的.并不断使用和复习才会成为高手,假设基础不是那么熟练.恐怕在成为高手的路上会困难重重.所以在做项目的间歇时间.偶尔回顾一下最基础的知识.是 ...
- BestCoder Round #11 (Div. 2) 题解
HDOJ5054 Alice and Bob Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/O ...
- Math.round(11.5)等于多少? Math.round(-11.5)等于多少?
1.先说下怎么理解 round()方法可以这样理解: 将括号内的数+0.5之后,向下取值, 比如:round(3.4)就是3.4+0.5=3.9,向下取值是3,所以round(3.4)=3; roun ...
- 【Java面试题】59 Math.round(11.5)等於多少? Math.round(-11.5)等於多少?
Math类中提供了三个与取整有关的方法:ceil.floor.round,这些方法的作用与它们的英文名称的含义相对应,例如,ceil的英文意义是天花板,该方法就表示向上取整,Math.ceil(11. ...
- Math.round(11.5)
Math.round(-11.5); Math.round(11.5); 经常看到这句代码,特意来总结一下. 查阅资料一直有人说是"四舍六入五成双",四舍六入没错,不过遇到正负数的 ...
- java基础面试题:Math.round(11.5)等於多少? Math.round(-11.5)等於多少?
package com.swift; public class Math_Round { public static void main(String[] args) { /* * Math roun ...
随机推荐
- 网络编程3之TCP/IP协议
在TCP/IP协议中,最重要的协议是[TCP.UDP.IP]协议 1.TCP/IP协议特点 1)Internet上不同系统之间互联的一组协议 2)为分散和不同类型的硬件提供通用的编程接口. 3)TCP ...
- Java之File类
一.初见File类 java.io.File类代表系统中的文件(文件或目录) 常用构造方法 File(String pathname) File(String parent, String child ...
- Spring学习(6)---Bean定义及作用域的例子
(一)Bean的定义 先定义一个BeanAnnotation package com.mypackage; import org.springframework.stereotype.Componen ...
- Vue爬坑之vuex初识
在 Vue.js 的项目中,如果项目结构简单, 父子组件之间的数据传递可以使用 props 或者 $emit 等方式 http://www.cnblogs.com/wisewrong/p/62660 ...
- 用javascript实现java的Map
function Map(){ var obj={}; //空的容器 //put方法 this.put=function(key,value){ obj[key]=value; //把键值绑定到obj ...
- 如何在phpstorm中安装xdebug调试工具
用习惯了Visio Studio的调试工具,如果写个php用phpstorm没有调试工具,觉得还缺点什么.接下来就讲解一下如果安装xdebug,最好发现这个插件真好用! 1.下载xdebug.tar: ...
- jQuery淡入淡出的轮播图
html结构: <div class="banna"> <ul class="img"> ...
- Example012点击修改属性
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- ajax来判断用户是否登录与添加
首先在用ajax之前,先说一下JSON: JSON:javascript object notation js对象标记 对于json,我们只需要知道如何定义json?如何输出?怎么遍历? 1.定义 ...
- 用CSS3实现无限循环的无缝滚动
有时候在页面的某个模块中,需要无限循环的滚动一些消息.那么如果我们用js实现无缝衔接滚动的思路是什么呢(比如我们这个模块是向上滚动的)? 克隆A一份完全一样的数据B放在原数据A的后面: 使用setIn ...