codeforces 466B Wonder Room(思维,暴力)
参考了别人的博客,百度来的博客
#include<iostream>
#include<string>
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
using namespace std; //暴力
//a ≤ a1; b ≤ b1 int main()
{
__int64 n,a,b;
scanf("%I64d%I64d%I64d",&n,&a,&b);
if(n*<=a*b)printf("%I64d\n%I64d %I64d\n",a*b,a,b);
else
{
__int64 mm=n*,x=a,y=b,mmm=;
__int64 m=(__int64)sqrt(mm)+;
for(__int64 i=a;i<=m;i++)
{
__int64 yy=mm/i+(mm%i!=);
if(yy*i>=mm&&yy>=b)
{
if(!mmm)mmm=i*yy,x=i,y=yy;
else if(yy*i<mmm)mmm=yy*i,x=i,y=yy;
}
}
for(__int64 i=b;i<=m;i++)
{
__int64 xx=mm/i+(mm%i!=);
if(xx*i>=mm&&xx>=a)
{
if(!mmm)mmm=i*xx,y=i,x=xx;
else if(xx*i<mmm)mmm=xx*i,y=i,x=xx;
}
}
printf("%I64d\n%I64d %I64d\n",mmm,x,y);
}
return ;
}
codeforces 466B Wonder Room(思维,暴力)的更多相关文章
- CodeForces - 593A -2Char(思维+暴力枚举)
Andrew often reads articles in his favorite magazine 2Char. The main feature of these articles is th ...
- codeforces 768 C. Jon Snow and his Favourite Number(思维+暴力)
题目链接:http://codeforces.com/contest/768/problem/C 题意:给出n个数,k个操作,和一个x,每次操作先排序然后对奇数位数进行xor x操作,最后问k次操作后 ...
- Codeforces 914 C 数位DP+暴力打表+思维
题意 给出一个二进制数\(n\),每次操作可以将一个整数\(x\)简化为\(x\)的二进制表示中\(1\)的个数,如果一个数简化为\(1\)所需的最小次数为\(k\),将这个数叫做特殊的数, 问从\( ...
- CodeForces - 1244D (思维+暴力)
题意 https://vjudge.net/problem/CodeForces-1244D 有一棵树,有3种颜色,第i个节点染成第j种颜色的代价是c(i,j),现在要你求出一种染色方案,使得总代价最 ...
- CodeForces - 1248D1 (思维+暴力)
题意 有一个括号序列,你可以选择两个位置i,j(i可以等于j),进行交换.使得最后的循环位置(i的数目)最大. 循环位置:i(0<=i<len),将前i个字符移到最后,得到的新序列是合法的 ...
- Nice Garland CodeForces - 1108C (思维+暴力)
You have a garland consisting of nn lamps. Each lamp is colored red, green or blue. The color of the ...
- CodeForces - 1230C(思维/暴力)
题意 https://vjudge.net/problem/CodeForces-1230C 给了你总共有21张多米诺骨牌,每张牌有两个面,然后给你一个无向图,保证没有环和一个顶点多条边的情况存在.现 ...
- Codeforces Gym 100015H Hidden Code 暴力
Hidden Code 题目连接: http://codeforces.com/gym/100015/attachments Description It's time to put your hac ...
- Codeforces gym 100685 A. Ariel 暴力
A. ArielTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100685/problem/A Desc ...
随机推荐
- Mac下OpenCV开发
1. 环境搭建 a) 安装Homebrew i. 下载地址:http://github.com/mxcl/homebrew/tarball/maste ...
- Android:解决cannot find zipalign的问题
如果当前使用的Android SDK是v20的话,在通过Eclipse或者Intellij IDEA打包Android项目时,会出现一个”cannot find zipalign”的错误. 这个错误的 ...
- Android studio图片ERROR: 9-patch image xx .9.png malformed
Android studio 图片错误 9-patch image error in Android ERROR: 9-patch image xx .9.png malformed 1) 异常: ...
- 【面试】【Spring常见问题总结】【07】
[常见面试问题总结文件夹>>>] 61.Spring IoC容器的依赖有两层含义: Bean依赖容器:也就是说Bean要依赖于容器,这里的依赖是指容器负责创建Bean并管理Bean的 ...
- WCF学习笔记——契约不能少了set
我定义的WCF契约里,有一个类,里面的属性,有一个因为只读,所以只写了个get.结果客户端就报错. [DataContract] public class UserItem { public User ...
- Codeforces Round #276 (Div. 1) A. Bits 贪心
A. Bits Let's denote as the number of bits set ('1' bits) in the binary representation of the non ...
- android 添加一个按键键值【转】
本文转载自:http://blog.csdn.net/u012719256/article/details/52526046 1.frameworks/base/data/keyboards/Gene ...
- iOS中的数据库—使用FMDB
一.回顾 iOS中的数据存储方式 1.XML属性列表(plist) 写入OC的一些基本数据类型,不是所有对象都可以写入 2.Preference(偏好设置) 本质还是通过“plist”来存储数据,但是 ...
- php write excel
/** * 写excel方法 */ function writeExcel($tabArr, $dataArr,$path) { require_once CODE_BASE2 . '/util/ph ...
- sql将一个表中的数据插入到另一个表中
sql将一个表中的数据插入到另一个表中 列名不一定要相同,只要你在HH中列出要插入列的列表跟select from mm表中的选择的列的列表一一对应就可以了,当然两边的数据类型应该是兼容的. ...