- 博客(21)
- 收藏
- 关注
原创 C++写代码易忘常识
1.scanf读入一个字符避免读入上一个换行符scanf()读取单个字符的时候,如果上面的语句也有scanf, 可能会读入换行符,导致读取的字符不是自己写入的字符。如果用scanf("%c",&ch),那么程序不会忽略为了输入而按下的回车键操作,而是认为回车键是后续操作而继续响应;而scanf(" %c", &ch)在%c之前空格会告诉scanf忽略前面的空行,而等...
2018-10-19 01:29:24 263
原创 ZOJ2104- Let the Balloon Rise 基础数据结构map
#include<bits/stdc++.h>using namespace std;map<string,int>balloon;int main(){ int n; scanf("%d",&n); string s; for(int i=0;i<n;i++) { cin>>...
2018-10-29 21:28:18 210
转载 isalpha() / isupper() / islower()函数
转载: https://blog.csdn.net/weixin_42072280/article/details/82782469
2018-10-25 17:58:02 339
原创 Oh Those Palindromes
A non-empty string is called palindrome, if it reads the same from the left to the right and from the right to the left. For example, "abcba", "a", and "abba" are palindromes, while "abab" and "xy" ar...
2018-10-24 22:16:16 237
原创 CF1064B Equations of Mathematical Magic
Colossal! — exclaimed Hawk-nose. — A programmer! That's exactly what we are looking for.Arkadi and Boris Strugatsky. Monday starts on SaturdayReading the book "Equations of Mathematical Magic" Rom...
2018-10-24 22:11:22 264
原创 神秘的钥匙 div2
链接:https://www.nowcoder.com/acm/contest/214/C来源:牛客网 题目描述clccle一行
2018-10-23 21:25:06 253
原创 数列的操作 div2
链接:https://www.nowcoder.com/acm/contest/214/F来源:牛客网 题目描述clccle是个蒟蒻,她经常会在学校机房里刷题,也会被同校的dalao们虐,有一次,她想出了一个毒瘤数据结构,便兴冲冲的把题面打了出来,她觉得自己能5s内切掉就很棒了,结果evildoer过来一看,说:"这思博题不是1s就能切掉嘛",clccle觉得自己的信心得到了打击,你能...
2018-10-23 20:50:41 176
原创 通过迭代器的位置返回值来获取数组位置下标的方法
首先介绍一个函数:distance,它返回的是两个迭代器之间的距离。使用这个函数,就能完成迭代器与下标之间的转换:下标 = 当前迭代器位置-容器头部注:在使用过程中,可以结合begin()和返回的迭代值进行求下标的计算。#include <iostream>#include <list>using namespace std;int main () {...
2018-10-23 20:09:05 9532
转载 lower_bound( )和upper_bound( )的常见用法
lower_bound( )和upper_bound( )都是利用二分查找的方法在一个排好序的数组中进行查找的。在从小到大的排序数组中,lower_bound( begin,end,num):从数组的begin位置到end-1位置二分查找第一个大于或等于num的数字,找到返回该数字的地址,不存在则返回end。通过返回的地址减去起始地址begin,得到找到数字在数组中的下标。upper_...
2018-10-23 19:04:25 374
原创 .云计算
题目描述北化ACM社团有n台云服务器,每台服务器都有一个使用期限,第i台服务器还能使用Ri天。现在有m个任务需要部署到云服务器上运行,第j个任务需要运行Tj天。第j个任务能够部署在第i台服务器上时当且仅当 Tj <=Ri,并且每台服务器在其使用期限内总共只能运行一个任务。即使Tk+Tj <=Ri,你也无法将第k个和第j个任务一起部署到第i 台服务器上,否则这题将失去其签到题的作用(...
2018-10-23 18:41:15 211
原创 水题的ZZH 【0-1背包】+【一维数组模板实现】
题目描述ZZH是北化acm界新生代的大佬,每天会和无数来自全球各地的大佬进行交流。但是,ZZH每天水群的时间有限。ZZH想尽可能多的和更强的大佬进行交流。他把每个大佬的实力用一个数字Ω表示出来,并且每天和Ω总和最高的几位大佬进行交流。但是ZZH正在忙着水群,于是把这个问题交给了你。事成之后,ZZH会给你2147483647%1的金币作为奖励 输入单组数据第一行两个整数n,m,分...
2018-10-23 17:19:54 228
转载 dd大牛的背包九讲 studying......
背包九讲 目录 第一讲 01背包问题 第二讲 完全背包问题 第三讲 多重背包问题 第四讲 混合三种背包问题 第五讲 二维费用的背包问题 第六讲 分组的背包问题 第七讲 有依赖的背包问题 第八讲 泛化物品 第九讲 背包问题问法的变化 附:USACO中的背包问题 前言本篇文章是我(dd_engi)正在进行中的一个雄心勃勃的写作计划的一部分,这个计划的内容是写作...
2018-10-23 16:45:41 169
原创 智力大奖赛 【数较大 】+水题+java大数类
输入只有一行,有一个整数N,表示大三角形的层数(N<=45000) 输出有两行,第一行只有一个数,表示小三角形的个数;第二行也只有一个数,表示能量棒的个数。分析:会等差数列的前n项和公式就可以搞定(草纸丢了,就不推了)代码:import java.math.BigInteger;import java.util.Scanner;public...
2018-10-23 16:41:26 897
原创 RMQ问题-----数据结构
RMQ问题就是求解区间内最大值或最小值的算法,没什么好说的ST算法也就是模板题大佬录制的学习视频:RMQ讲解ST算法流程1.预处理 /*RMQ问题的预处理*/void RMQ(int num)///预处理->O(nlogn){ for(int j=1;j<20;j++)///2^j代表区间的最大长度位置的坐标 { for(int...
2018-10-20 16:11:57 298
原创 Heaters
Vova's house is an array consisting of nn elements (yeah, this is the first problem, I think, where someone lives in the array). There are heaters in some positions of the array. The ii-th element of ...
2018-10-19 01:03:24 407
原创 Boxes Packing 思维+技巧
Maksim has nn objects and mm boxes, each box has size exactly kk. Objects are numbered from 11 to nn in order from left to right, the size of the ii-th object is aiai.Maksim wants to pack his object...
2018-10-18 15:40:14 682
原创 A. Vova and Train 思维+技巧
Vova plans to go to the conference by train. Initially, the train is at the point 11 and the destination point of the path is the point LL. The speed of the train is 11 length unit per minute (i.e. at...
2018-10-18 15:03:36 714
原创 数据结构————树状数组
原数组--->前缀和------>范围和原数组更改数组元素在求和效率较低,引入树状数组假设原数组A【】 树状数组C【】树状数组 的三种操作:1.lowbit() 子叶数(二进制最低位的1代表多少) 代码实现: int lowbit(int n){ return x&(-x);} 求:lowbit(x) returnx&a...
2018-10-13 19:05:51 191
原创 HDU - 1520 Anniversary party (有向入门树形DP)
University. The University has a hierarchical structure of employees. It means that the supervisor relation forms a tree rooted at the rector V. E. Tretyakov. In order to make the party funny for ever...
2018-10-08 22:00:15 137
原创 POJ2411:Mondriaan's Dream(状压DP)
DescriptionSquares and rectangles fascinated the famous Dutch painter Piet Mondriaan. One night, after producing the drawings in his 'toilet series' (where he had to use his toilet paper to draw on,...
2018-10-04 11:28:10 173
转载 位运算及其应用详解
转自:http://blog.chinaunix.net/uid-21411227-id-1826986.html一.逻辑运算符 1.& 位与运算 1) 运算规则 位与运算的实质是将参与运算的两个数据,按对应的二进制数逐位进行逻辑与运算。例如:int型常量4和7进行位与运算的运算过程如下:4=0000 0000 0000 0100 &7 =0000 0000 ...
2018-10-04 08:27:06 2908
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人