【思路|模拟|构造】
riba2534
没有谁生来就是神牛,而千里之行,始于足下!
展开
-
51Nod - 1125 交换机器的最小代价(贪心,思路)
描述 有N台机器重量各不相等,现在要求把这些机器按照重量排序,重量从左到右依次递增。移动机器只能做交换操作,但交换机器要花费一定的费用,费用的大小就是交换机器重量的和。例如:3 2 1,交换1 3后为递增排序,总的交换代价为4。给出N台机器的重量,求将所有机器变为有序的最小代价。(机器的重量均为正整数)Input 第1行:1个数N,表示机器及房间的数量。(2 <= N <= 5000原创 2017-12-18 23:22:10 · 638 阅读 · 0 评论 -
第13届景驰-埃森哲杯广东工业大学ACM程序设计大赛 J 强迫症的序列(思路)
题目描述 牛客网是IT求职神器,提供海量C++、JAVA、前端等职业笔试题库,在线进行百度阿里腾讯网易等互联网名企笔试面试模拟考试练习,和牛人一起讨论经典试题,全面提升你的编程。作为acmer的小A,牛客网是他首选的题库。 小A是一个中度强迫症患者,每次做数组有关的题目都异常难受,他十分希望数组的每一个元素都一样大,这样子看起来才是最棒的,所以他决定通过一些操作把这个变成一个看起来不...原创 2018-03-24 18:13:56 · 222 阅读 · 0 评论 -
第13届景驰-埃森哲杯广东工业大学ACM程序设计大赛 K 密码(模拟)
题目描述 ZiZi登录各种账号的时候,总是会忘记密码,所以他把密码都记录在一个记事本上。其中第一个密码就是牛客网的密码。 牛客网专注于程序员的学习、成长及职位发展,连接C端程序员及B端招聘方,通过IT笔试面试题库、在线社区、在线课程等提高候选人的求职效率,通过在线笔试、面试及其他工具提升企业的招聘效率。 团队由来自Google、百度、阿里、网易等知名互联网巨头的热血技术青年...原创 2018-03-26 09:59:29 · 206 阅读 · 0 评论 -
第13届景驰-埃森哲杯广东工业大学ACM程序设计大赛 G 旋转矩阵(模拟)
题目描述 景驰公司自成立伊始,公司便将“推动智能交通的发展,让人类的出行更安全,更高效,更经济,更舒适”作为公司使命,通过产业融合、建设智能汽车出行行业的方式,打造“利国、利民、利公司、利个人”的无人驾驶出行系统。公司的愿景是成为中国第一、世界一流的智能出行公司。 有一天,景驰公司的工程师在真车上做测试。 景驰公司的试验车上面有一个奇怪的图案,这是一个n*m的矩阵,这辆车可...原创 2018-03-26 12:50:56 · 335 阅读 · 0 评论 -
UVALive - 7500 Boxes and Balls(思路)
描述 Little Tom’s friend Jack just showed him a great magic trick. At the beginning of the trick, there is one box on the ground with some number of balls in it. Jack then performs this operat...原创 2018-04-04 14:47:50 · 256 阅读 · 0 评论 -
HRBUST-2322 Team(模拟)
Description Kim 正在玩一款手游,在这款游戏中,Kim可以选择若干个角色编成一队作战。为了挑战不同的关卡,Kim需要不断的调整编队阵容。然而随着游戏不断更新,队伍成员变得越来越多,Kim已经记不清哪些角色在队伍中,哪些角色不在队伍中了。请你写一个程序来帮助他。 具体来说,Kim有三种可以执行的操作。 1 x :把 x 号角色加入队伍。如果x号角色已...原创 2018-04-04 15:06:27 · 185 阅读 · 0 评论 -
HihoCoder - 1721 回文字符串2(思路)
描述 愚人节那天,小Ho在小Hi的一个回文字符串中添加了一个字符。你能帮助小Hi找到被添加的是第几个字符吗?输入 一个只包含小写字母的字符串S。 对于70%的数据,|S| ≤ 1000 对于100%的数据,|S| ≤ 500000输出 输出一个整数K,表示删除第K(从1开始计数)个字符后,S会变成一个回文字符串。 数据保证有...原创 2018-04-11 19:55:57 · 367 阅读 · 0 评论 -
51Nod - 1521 一维战舰 (思路,set)
描述 爱丽丝和鲍博喜欢玩一维战舰的游戏。他们在一行有n个方格的纸上玩这个游戏(也就是1×n的表格)。 在游戏开始的时候,爱丽丝放k个战舰在这个表格中,并不把具体位置告诉鲍博。每一只战舰的形状是 1×a 的长方形(也就是说,战舰会占据a个连续的方格)。这些战舰不能相互重叠,也不能相接触。 然后鲍博会做一系列的点名。当他点到某个格子的时候,爱丽丝会告诉他那个格子是否被...原创 2018-05-01 21:35:02 · 280 阅读 · 0 评论 -
ZOJ3780 Paint the Grid Again(模拟)
描述 Leo has a grid with N × N cells. He wants to paint each cell with a specific color (either black or white). Leo has a magical brush which can paint any row with black color, or any c...原创 2018-04-24 18:15:03 · 280 阅读 · 0 评论 -
51Nod - 1682 中位数计数 (思维)
描述 中位数定义为所有值从小到大排序后排在正中间的那个数,如果值有偶数个,通常取最中间的两个数值的平均数作为中位数。 现在有n个数,每个数都是独一无二的,求出每个数在多少个包含其的区间中是中位数。Input 第一行一个数n(n<=8000) 第二行n个数,0<=每个数<=10^9Output N个数,依次表示第i个数在多少包含其的区间...原创 2018-04-27 10:30:16 · 249 阅读 · 0 评论 -
2017第八届蓝桥杯省赛-大学B组 等差素数列(模拟)
描述 2,3,5,7,11,13,….是素数序列。 类似:7,37,67,97,127,157 这样完全由素数组成的等差数列,叫等差素数数列。 上边的数列公差为30,长度为6。 2004年,格林与华人陶哲轩合作证明了:存在任意长度的素数等差数列。 这是数论领域一项惊人的成果! 有这一理论为基础,请你借助手中的计算机,满怀信心地搜索: 长度为10的等差素数...原创 2018-03-13 20:46:36 · 473 阅读 · 0 评论 -
Codeforces Round #470 (rated, Div. 2, based on VK Cup 2018 Round 1) A. Protect Sheep(思路)
描述 Bob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of them due to wolf attacks. He thus decided to place some shepherd dogs in such a way that all his she...原创 2018-03-11 11:27:17 · 508 阅读 · 0 评论 -
Codeforces-Good Bye 2017 B. New Year and Buggy Bot(模拟)
Describe Bob programmed a robot to navigate through a 2d maze. The maze has some obstacles. Empty cells are denoted by the character ‘.’, where obstacles are denoted by ‘#’. There is a s原创 2017-12-30 11:33:40 · 493 阅读 · 0 评论 -
POJ1028 Web Navigation(模拟)
Description Standard web browsers contain features to move backward and forward among the pages recently visited. One way to implement these features is to use two stacks to keep track of th原创 2018-01-31 10:42:29 · 269 阅读 · 0 评论 -
2016蓝桥杯C/C++省赛 凑算式+搭积木(暴力,水题)
题目:代码:(答案是29种)#include #include #include #include #include #include #include #include #define mem(a,b) memset(a,b,sizeof(a))#define inf 0x3f3f3f3f#define N 1000+10#define LL lon原创 2017-03-19 13:57:51 · 2500 阅读 · 1 评论 -
2016蓝桥杯C/C++省赛 交换瓶子(超级大水题)
题目:思路:刚一看这题是归并排序。。然后写了一发感觉不对劲啊。。。然后以为是选择排序。。。,最后也看了一下不对劲啊,md就是一发超级大水题。。,不就比较一下么。。代码:#include #include #include #include #include #include #include #include #include #define mem(原创 2017-03-24 20:15:24 · 1035 阅读 · 1 评论 -
2016蓝桥杯C/C++省赛 四平方和(暴力,水题)
题目:直接暴力就好。。代码:#include <cstdio>#include <cstring>#include <string>#include <iostream>#include <cmath>#include <stack>#include <queue>#include <v原创 2017-03-25 15:37:31 · 1042 阅读 · 0 评论 -
2017蓝桥杯官方模拟赛 猜数字(暴力枚举)
题目:思路:用i和j代表两个乘数,然后在判断是否出现了两次即可代码:#include #include #include #include #include #include #include #include #define mem(a,b) memset(a,b,sizeof(a))#define N 1000+20#define inf 0x3原创 2017-03-31 21:07:29 · 1710 阅读 · 0 评论 -
蓝桥杯2017官方模拟赛 还款计算(思路)
题目: 银行贷款的等额本息还款方法是: 每月还固定的金额,在约定的期数内正好还完(最后一个月可能会有微小的零头出入)。 比如说小明在银行贷款1万元。贷款年化利率为5%,贷款期限为24个月。 则银行会在每个月进行结算: 结算方法是:计算本金在本月产生的利息: 本金 x (年利率/12) 则本月本金结余为:本金 + 利息 - 每月固定还款额 计算结果会四原创 2017-04-07 01:33:42 · 826 阅读 · 0 评论 -
Codeforces Round #457 (Div. 2) B. Jamie and Binary Sequence(二进制,思路,贪心)
描述 Jamie is preparing a Codeforces round. He has got an idea for a problem, but does not know how to solve it. Help him write a solution to the following problem: Find k integers such t原创 2018-01-20 15:23:28 · 772 阅读 · 2 评论 -
Codeforces Round #469 (Div. 2) C. Zebras(思路+模拟)
描述 Oleg writes down the history of the days he lived. For each day he decides if it was good or bad. Oleg calls a non-empty sequence of days a zebra, if it starts with a bad day, ends with a...原创 2018-03-10 15:33:27 · 285 阅读 · 0 评论 -
HDU4452 Running Rabbits(模拟,方格转向)
Problem Description Rabbit Tom and rabbit Jerry are running in a field. The field is an N×N grid. Tom starts from the up-left cell and Jerry starts from the down-right cell. The coordinate o...原创 2018-05-05 21:57:03 · 598 阅读 · 0 评论 -
Codeforces Round #479 (Div. 3) F. Consecutive Subsequence(思路,最长连续递增子序列)
描述 You are given an integer array of length nn. You have to choose some subsequence of this array of maximum length such that this subsequence forms a increasing sequence of consecutive ...原创 2018-05-07 09:36:01 · 1368 阅读 · 1 评论 -
LOJ2499 联合权值(树,思路)
题目描述 无向连通图GGG 有nnn 个点,n−1n−1n−1 条边。点从 111 到 nnn 依次编号,编号为 iii 的点的权值为 WiWiW_i,每条边的长度均为111。图上两点 (u,v)(u,v)(u,v)的距离定义为 uuu 点到 vvv 点的最短距离。对于图 GGG 上的点对 (u,v)(u,v)(u,v) ,若它们的距离为 222 ,则它们之间会产生Wv×...原创 2018-05-21 09:56:09 · 239 阅读 · 0 评论 -
Educational Codeforces Round 51 (Rated for Div. 2) C. Vasya and Multisets(思路)
描述Vasya has a multiset ss consisting of nn integer numbers. Vasya calls some number xx nice if it appears in the multiset exactly once. For example, multiset {1,1,2,3,3,3,4}{1,1,2,3,3,3,4} contains ...原创 2018-09-21 20:32:30 · 423 阅读 · 0 评论 -
Codeforces Round #511 (Div. 2) C. Enlarge GCD(思路,数论)
描述Mr. F has nn positive integers, a1,a2,…,ana1,a2,…,an.He thinks the greatest common divisor of these integers is too small. So he wants to enlarge it by removing some of the integers.But this prob...原创 2018-09-22 21:03:50 · 775 阅读 · 0 评论 -
CodeForces - 825D Suitable Replacement(思路)
描述You are given two strings s and t consisting of small Latin letters, string s can also contain ‘?’ characters.Suitability of string s is calculated by following metric:Any two letters can be swa...原创 2018-10-14 16:54:05 · 270 阅读 · 1 评论 -
CodeForces - 796C Bank Hacking(思路)
描述Although Inzane successfully found his beloved bone, Zane, his owner, has yet to return. To search for Zane, he would need a lot of money, of which he sadly has none. To deal with the problem, he ...原创 2018-10-14 23:06:59 · 299 阅读 · 0 评论 -
HDU5533 Dancing Stars on Me(几何,思路)
Problem DescriptionThe sky was brushed clean by the wind and the stars were cold in a black sky. What a wonderful night. You observed that, sometimes the stars can form a regular polygon in the sky ...原创 2018-10-09 20:24:11 · 284 阅读 · 0 评论 -
Codeforces Round #513 by Barcelona Bootcamp (rated, Div. 1 + Div. 2) C. Maximum Subrectangle(思路)
描述You are given two arrays aa and bb of positive integers, with length nn and mm respectively.Let cc be an n×mn×m matrix, where ci,j=ai⋅bjci,j=ai⋅bj.You need to find a subrectangle of the matrix c...原创 2018-10-10 20:09:49 · 253 阅读 · 0 评论 -
HihoCoder - 1318 非法二进制数(找规律,BM线性递推)
描述如果一个二进制数包含连续的两个1,我们就称这个二进制数是非法的。小Hi想知道在所有 n 位二进制数(一共有2n个)中,非法二进制数有多少个。例如对于 n = 3,有 011, 110, 111 三个非法二进制数。由于结果可能很大,你只需要输出模109+7的余数。输入一个整数 n (1 ≤ n ≤ 100)。输出n 位非法二进制数的数目模109+7的余数。样例输入...原创 2018-10-19 21:20:02 · 518 阅读 · 0 评论 -
HihoCoder - 1873 2018ICPC北京站 D. Frog and Portal(构造)
描述A small frog wants to get to the other side of a river. The frog is initially located at one bank of the river (position 0) and wants to get to the other bank (position 200). Luckily, there are 19...原创 2018-11-14 15:25:34 · 909 阅读 · 0 评论 -
LeetCode 440. K-th Smallest in Lexicographical Order(思路)
题目链接:440. K-th Smallest in Lexicographical OrderGiven integers n and k, find the lexicographically k-th smallest integer in the range from 1 to n.Note: 1 ≤ k ≤ n ≤ 109.Example:Input:n: 13 k: 2...原创 2019-03-01 09:04:10 · 585 阅读 · 2 评论 -
G. Trace(ACM-ICPC 2018 徐州赛区网络预赛,思路,set)
描述 There’s a beach in the first quadrant. And from time to time, there are sea waves. A wave ( xx , yy ) means the wave is a rectangle whose vertexes are ( 00 , 00 ), ( xx , 00 ), ( 00 , yy ), ( x...原创 2018-09-10 09:32:06 · 404 阅读 · 0 评论 -
HDU6400 Parentheses Matrix(2018HDU多校联赛第八场,构造)
Problem Description A parentheses matrix is a matrix where every element is either ‘(’ or ‘)’. We define the goodness of a parentheses matrix as the number of balanced rows (from left to right) an...原创 2018-08-15 23:41:18 · 289 阅读 · 0 评论 -
Codeforces Round #482 (Div. 2) C. Kuro and Walking Route(dfs,思路)
描述 Kuro is living in a country called Uberland, consisting of nn towns, numbered from 11 to nn, and n−1n−1 bidirectional roads connecting these towns. It is possible to reach each town from ...原创 2018-05-15 16:35:51 · 329 阅读 · 0 评论 -
HDU6298 Maximum Multiple(2018HDU多校联赛第一场,思路)
Problem Description Given an integer n, Chiaki would like to find three positive integers x, y and z such that: n=x+y+z, x∣n, y∣n, z∣n and xyz is maximum.Input There are multiple test ca...原创 2018-07-24 00:05:08 · 266 阅读 · 0 评论 -
HDU6308 Time Zone(2018HDU多校联赛第一场,模拟)
Problem Description Chiaki often participates in international competitive programming contests. The time zone becomes a big problem. Given a time in Beijing time (UTC +8), Chiaki would like...原创 2018-07-24 00:11:28 · 458 阅读 · 0 评论 -
Educational Codeforces Round 48 (Rated for Div. 2) D. Vasya And The Matrix(构造)
描述 Now Vasya is taking an exam in mathematics. In order to get a good mark, Vasya needs to guess the matrix that the teacher has constructed! Vasya knows that the matrix consists of n rows an...原创 2018-08-04 11:48:51 · 307 阅读 · 0 评论 -
HDU6330 Problem L. Visual Cube(2018HDU多校联赛第三场,模拟)
Problem Description Little Q likes solving math problems very much. Unluckily, however, he does not have good spatial ability. Everytime he meets a 3D geometry problem, he will struggle to draw a ...原创 2018-07-31 18:03:40 · 327 阅读 · 0 评论