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 ...
随机推荐
- firedac的TFDStoredProc动态创建并调用存储过程
1)中间件执行存储过程 sp.Close; sp.StoredProcName := procName; sp.Prepare; // 生成存储过程的参数列表,无任何OUTPUT的存储过程,也会自动 ...
- tabBar颜色改动
//未点击的颜色 [[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKey ...
- Android Notification状态栏通知
没有添加额外的震动及声音效果,这里直接实现了通知的功能,看效果吧: MainActivity.java package com.example.notification; import android ...
- WEB开发面试题
1.HTML的全称: 2.HTML的结构: 3.经常使用标签: 4.CSS的全称: 5.CSS的作用: 6.CSS中创建Class的语法: ...
- python 004 执行环境对比
对比:os.system os.popen subprocess.Popen subprocess.call 为什么要搞这么多? # --*--encoding: utf-8--*-- import ...
- mysql20170404代码实现
CREATE DATABASE IF NOT EXISTS school; USE school; CREATE TABLE tblStudent( StuId ) NOT NULL PRIMARY ...
- 20170322js面向对象
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...
- RK摄像头移植【转】
本文转载自:http://wiki.t-firefly.com/index.php/Firefly-RK3288/Camera 板载资源 Firefly-RK3288 开发板带有一个 MIPI 摄像头 ...
- bzoj 1026 [ SCOI2009 ] windy数 —— 数位DP
题目:https://www.lydsy.com/JudgeOnline/problem.php?id=1026 蛮简单的数位DP,预处理 f[i][j] 表示 i 位数,以 j 开头的 windy ...
- PCB MS SERVER 使用bcp命令将数据库数据导出到Excel
在前年工程系统与APS系统对接时,需将工程系统数据导出来给APS,采用的正是bcp命令实现,速度超快. 这里将此命令使用方法整理如下: 一.写SQL将表数据导出到Excel @echo "& ...