玲珑杯 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 ...
随机推荐
- SQL构架(转)
在一次的实际工作中碰到以下情况,在 SQL SERVER 2008中,新建了一个新用户去访问几张由其他用户创建的表,但是无法进行查询,提示“对象名'CustomEntry' 无效.”.当带上了架构名称 ...
- 打开IIS的快捷键
[windows键+R]→在运行界面输入“inetmgr”→点击回车键,即可以出现IIS界面
- string services
string通用字符串操作: re,正则表达式 difflib,比较序列 stringIO:以文件的方式来读和写字符串 CstringIO:更快捷的stringIO版本 textwrap:文本包装和填 ...
- [转]Java多线程学习(吐血超详细总结)
转自:http://www.mamicode.com/info-detail-517008.html 本文主要讲了Java中多线程的使用方法.线程同步.线程数据传递.线程状态及相应的一些线程函数用法. ...
- An overnight dance in discotheque
An overnight dance in discotheque time limit per test 2 seconds memory limit per test 256 megabytes ...
- 数列[专杀Splay版]
时间限制: 3 Sec 内存限制: 128 MB提交: 49 解决: 7 题目描述 输入一个数列,你需要进行如下操作: 1. 把编号为I的数值改为K 2. 输出从小到大排序后第k个数 输入 输 ...
- dubbo 请求调用过程分析
服务消费方发起请求 当服务的消费方引用了某远程服务,服务的应用方在spring的配置实例如下: <dubbo:referenceid="demoService"interfa ...
- css清除浮动float
css清除浮动float 1.分析HTML代码 <div class="outer"> <div class="div1">1</ ...
- 屏幕适配/autoLayout autoresizingMask
#pragma mark-- 屏幕适配/autoLayout autoresizingMask 1> 发展历程 代码计算frame -> autoreszing(父控件和子控件的关系) - ...
- Python使用QRCode生成二维码
PIL和QRCode下载地址: http://www.pythonware.com/products/pil/ https://pypi.python.org/pypi/qrcode/5.1 #你可能 ...