玲珑杯 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 ...
随机推荐
- Java将头像图片保存到MySQL数据库
在做头像上传的过程中通常是将图片保存到数据库中,这里简单介绍一中将图片保存到数据库的方法: jsp代码: <div> <input class="avatar-input& ...
- laravel中的多对多关系详解
数据表之间是纵横交叉.相互关联的,laravel的一对一,一对多比较好理解,官网介绍滴很详细了,在此我就不赘述啦,重点我记下多对多的关系 一种常见的关联关系是多对多,即表A的某条记录通过中间表C与表B ...
- Buffer深入分析
Buffer Buffer的类图如下: 除了Boolean,其他基本数据类型都有对应的Buffer,但是只有ByteBuffer才能和Channel交互.只有ByteBuffer才能产生Direct的 ...
- 深入探索C++对象模型(六)
执行期语意学(Runtime Semantics) 对象的构造和析构(Object Constructor and Destructor) 一般而言,constructor和destructor的安插 ...
- jquery中的$(document).ready()使用小结
本篇文章主要是对jquery中的$(document).ready()使用方法进行了详细的总结介绍,需要的朋友可以过来参考下,希望对大家有所帮助 window.onload = function(){ ...
- 模拟对象测试——EasyMock
一.EasyMock 使用动态代理实现模拟对象创建,一般可以满足以下测试需求 1.要测试的模块依赖于其它自己控制不了的模块,如第三方服务,其它组员在开发的服务等,它们都没办法配合你来测试: 2.涉及到 ...
- mac os 安装PIP 及异常“”Can't install python module: PyCharm Error: “byte-compiling is disabled, skipping”“”的解决方案
For all who have the same problem, it took me a while to find the solution in a new installation of ...
- 动态分配数组(new)和用随机数赋值(rand)
#include <iostream>#include <ctime>#include <cstdlib>using namespace std; int main ...
- Solr集群搭建
SolrCloud需要solr基于zookeeper部署,zookeeper是一个集群管理软件,由于SolrCloud需要由多台服务器组成.由zookeeper来进行协调管理.Zookeeper是一个 ...
- ASP.NET Core部署到CentOS7,使用Nginx代理
ASP.NET Core 的运行环境由新开发的 Kestrel Server 负责,IIS 退回到 HTTP 的侦听器的角色,微软也特别为了这个需求开发了 IIS Platform Handler,以 ...