cf854B Maxim Buys an Apartment】的更多相关文章

Maxim Buys an Apartment #include <iostream> #define int long long using namespace std; int n,k; signed main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> k;//n是公寓数,1-n; k出售的公寓数量,编号未知 //题意给的条件:符合他的 : 待售的公寓相邻的至少有一个已经有人住…
题目链接:http://codeforces.com/contest/854/problem/B 题意: 有n栋房子从1到n排成一排,有k栋房子已经被售出. 现在你要买一栋“好房子”. 一栋房子是“好房子”的要求:(1)没被售出 (2)至少有一栋已售出的房子与他相邻(有邻居) 问你可能的好房子总数量的最小值和最大值. 题解: 贪心. 最小值: 从第1栋房子开始紧挨着往右共k栋全都售出了,好房子只有一栋就是第k栋楼的右边一栋. 特判:k == 0 || n == k:没有好房子,输出0. 最大值:…
题意:已知一条街上有n幢房子,依次的编号为1~n,其中有k幢已经卖出去了但是不知道是哪k幢.当且仅当一幢房子没有卖出去且其两旁至少有一幢房子卖出去了的时候,认为这幢房子是好的.问这n幢房子中好的房子最多.最少可能有多少. 思路:简单的贪心(但是不小心可能错).首先如果k==n或者k==0,那么显然不可能有任何好的房子.否则,当将所有的卖出去的房子的位置连续地放在街的一端时,好的房子的数量取到最小值1.当n>=k*3时,将n个房子按每三个为一段分开,其中任选k段使中间的那一个房子为卖出去的,那么这…
[链接]h在这里写链接 [题意] 你有n个位置,然后其中有k个地方是已经被人占据了的. 一个"好的位置"的定义是指,这个位置相邻的地方其中至少有一个被人占据了. k个被人占据的位置是不确定的,由你决定. 问你最少的和最多的"好的位置"的个数. [题解] 肯定是010 010 010...这样的安排最优. 也就是3个3个地安排,然后中间放一个被占据的位置. 如果k<=n/3,那么答案就是2*k,因为每个被占据的位置都能产生两个好的位置. 如果k>n/3 如…
A. Fraction 题目链接:http://codeforces.com/contest/854/problem/A 题目意思:给出一个数n,求两个数a+b=n,且a/b不可约分,如果存在多组满足条件的a和b,输出a/b最大的a和b. 题目思路:首先a+b=n,那么暴力枚举i和n-i,且gcd(i,n-i)==1,由于i越大是n-i越小,则a/b的值越大. 代码: //Author: xiaowuga #include <bits/stdc++.h> using namespace std…
题目链接:Codeforces Round #433 (Div. 2) codeforces 854 A. Fraction[水] 题意:已知分子与分母的和,求分子小于分母的 最大的最简分数. #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> using namespace std; int gcd(int a,int b){return b?gcd(b…
A. Fraction 暴力遍历1-1000,取组成的真分数比值最大且分子分母gcd为1时更新答案 代码: #include <stdio.h> #include <algorithm> #include <cstdlib> #include <cstring> #include <bitset> #include <string> #include <stack> #include <cmath> #incl…
A - Turn the Rectangles CodeForces - 1008B There are nn rectangles in a row. You can either turn each rectangle by 9090 degrees or leave it as it is. If you turn a rectangle, its width will be height, and its height will be width. Notice that you can…
Maxim wants to buy some games at the local game shop. There are n games in the shop, the i-th game costs ci. Maxim has a wallet which can be represented as an array of integers. His wallet contains m bills, the j-th bill has value aj. Games in the sh…
http://codeforces.com/problemset/problem/261/B 题目大意:给定n个数a1-an(n<=50,ai<=50),随机打乱后,记Si=a1+a2+a3-+ai,问满足Si<=p的i的最大值的期望.(p<=50) (大意来自于http://www.cnblogs.com/liu-runda/p/6253569.html) 我们知道,全排列其实等价于我们一个一个地等概率地向一个序列里面插入数值 所以我们可以这么看这道题: 现在有n个数,有n个盒子…
C. Hongcow Buys a Deck of Cards time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output One day, Hongcow goes to the store and sees a brand new deck of n special cards. Each individual card is eit…
Building #11 is undergoing a major renovation. Implement a query to close all requests from apartments in this building. -- TABLE Apartments +-------+------------+------------+ | AptID | UnitNumber | BuildingID | +-------+------------+------------+ |…
Write a SQL query to get a list of all buildings and the number of open requests (Requests in which status equals 'Open'). -- TABLE Apartments +-------+------------+------------+ | AptID | UnitNumber | BuildingID | +-------+------------+------------+…
Write a SQL query to get a list of tenants who are renting more than one apartment. -- TABLE Apartments +-------+------------+------------+ | AptID | UnitNumber | BuildingID | +-------+------------+------------+ | 101 | A1 | 11 | | 102 | A2 | 12 | |…
Apartment 2019 最近在学习3D建模,Apartment 2019是我的个人项目. 初步的想法是,先在网上找公寓建筑的平面图以及室内效果照片,根据这些参考图像来练习建模与渲染. 建模顺序与计划 第一阶段:公寓整体框架结构 房屋墙体 walls 窗户 windows 门 doors 地板 floor 天花板 ceiling 第二阶段:室内主要家具 衣柜 床.床头柜 电视柜 餐桌.椅子 沙发 茶几 书桌 书柜 电脑桌 第三阶段:厨房与卫生间 厨柜 厨房水槽 燃气灶 抽油烟机 燃气热水器…
Hongcow Buys a Deck of Cards 啊啊啊, 为什么我连这种垃圾dp都写不出来.. 不是应该10分钟就该秒掉的题吗.. 从dp想到暴力然后gg, 没有想到把省下的红色开成一维. #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk make_pair #define PLL pair<LL, LL> #define PLI pair&…
D. Maxim and Array 题目连接: http://codeforces.com/contest/721/problem/D Description Recently Maxim has found an array of n integers, needed by no one. He immediately come up with idea of changing it: he invented positive integer x and decided to add or…
B. Maxim and Restaurant time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Maxim has opened his own restaurant! The restaurant has got a huge table, the table's length is p meters. Maxim has…
地址:http://codeforces.com/problemset/problem/744/C 题目: C. Hongcow Buys a Deck of Cards time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output One day, Hongcow goes to the store and sees a brand ne…
D. Maxim and Array time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Recently Maxim has found an array of n integers, needed by no one. He immediately come up with idea of changing it: he in…
题目链接:http://codeforces.com/problemset/problem/721/D D. Maxim and Array time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Recently Maxim has found an array of n integers, needed by no one. He…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Recently Maxim has found an array of n integers, needed by no one. He immediately come up with idea of changing it: he invented positive integer…
题目描述: Maxim and Array time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Recently Maxim has found an array of n integers, needed by no one. He immediately come up with idea of changing it: he…
CF261E Maxim and Calculator 洛谷评测传送门 题目描述 Maxim has got a calculator. The calculator has two integer cells. Initially, the first cell contains number 11 , and the second cell contains number 00 . In one move you can perform one of the following operat…
今日焦点 month-to-month 按月 6-month minimum 至少六个月 sublease 转租 drenched in sunlight 阳光充足的 词汇实践 I am looking for an apartment I can rent month-to-month. 我想找一个按月租的房子. I'm betweenjobs so I might be moving to a new city soon. 我在找工作,而且可能搬去别的城市. But most of the…
Maxim and Calculator 题目链接:https://www.luogu.org/problem/CF261E 数据范围:略. 题解: 考试的时候只会暴力,学弟太强了$\%\%\% Orz$. 感觉直接处理不太好处理,得想到所有有可能被这种操作在$100$步表示出来. 先打个表. 之后就随便$dpdp$就好了,关键是你得想到所有合法的数非常小. 我反正是没想到..... 代码: #include <bits/stdc++.h> #define N 3000010 using na…
CF261E Maxim and Calculator 题目大意: 有两个初始参数 $ a=1 $ , $ b=0 $ ,你可以对它们进行两个操作: $ b~+=1 $ 或 $ a~\times =b $ ,最终的 $ a $ 才是你所得到的数 . 现在给你三个数 $ l,r,p $ ,让你求在区间 $ [l,r] $ 内可以用不超过 $ p $ 次操作得到的数的个数.数据范围: $ (2<=l<=r<=10^{9},1<=p<=100) $ $ solution: $ 很神…
项目介绍 项目地址:https://github.com/zhangzhao4444/Maxim 与monkey对比优势: 快 稳:只进行有意义的操作,防误点状态栏,不会乱断网.卸载应用 支持脱机运行,错误日志可以记录到手机本地 支持自定义:控件黑白名单,自定义操作步骤,控件操作优先级 截图支持 使用方法 将两个jar文件push到根目录 maxim.zip adb push framework.jar /sdcard    adb push monkey.jar /sdcard 脱机运行方法(…
Recently Maxim has found an array of n integers, needed by no one. He immediately come up with idea of changing it: he invented positive integer x and decided to add or subtract it from arbitrary array elements. Formally, by applying single operation…
网上DS12C887的文章涉及到时间的存储格式使用的都是二进制代码,究竟使用BCD码该如何操作?正好美信官网上有一篇文章.美信官网不稳定,先贴到这里,有时间再翻译. 原文链接 State Machine Logic in Binary-Coded Decimal (BCD)-Formatted Real-Time Clocks 摘要 : When developing code to operate a real-time clock (RTC), it is often beneficial…