c++
m0_61067261
这个作者很懒,什么都没留下…
展开
-
c++关键字
asm do if return typedef auto double inline short typeid bool dynamic_cast int signed typename ...原创 2021-12-11 17:13:42 · 321 阅读 · 0 评论 -
CF236A Boy or Girl
题目描述Those days, many boys use beautiful girls' photos as avatars in forums. So it is pretty hard to tell the gender of a user at the first glance. Last year, our hero went to a forum and had a nice chat with a beauty (he thought so). After that they talk原创 2021-11-06 17:22:22 · 322 阅读 · 2 评论 -
CF231A Team(dfs再次出现)
题目描述One day three best friends Petya, Vasya and Tonya decided to form a team and take part in programming contests. Participants are usually offered several problems during programming contests. Long before the start the friends decided that they will im原创 2021-11-06 17:11:25 · 311 阅读 · 1 评论 -
CF230A Dragons(dfs深搜经典例题)
传送门传送门题意翻译小方在跟龙进行比赛,他要是想进入下一层级,就必须要击败在这一层级上的所有的n条龙。 小方和每一条龙都有一个可以用整数表示的力量值,在每一次战斗中,该次战斗的结果由战斗的双方的力量值所决定。在一开始,小方的力量值是s在任意一次战斗中,如果小方的力量值比第i条龙(1<=i<=n)的力量值大,那么小方可以击败这头龙并且获得额外的力量值y(i),如果小方的力量值小于这头龙的力量值,那么小方将在这场战斗中死亡小方可以以任意的一个顺序和龙进行战斗。请编写程序确定小方是原创 2021-11-06 17:00:10 · 282 阅读 · 2 评论 -
求正方形周长
输入一个数,代表正方形的长度,输出一个数,代表正方形的周长#include <cstdio>using namespace std;int lenth, ans;int main(){ printf("%s\n", "tell me the lenth of the square you want"); scanf("%d", &lenth); printf("%d\n", 4 * lenth); return 0;} ...原创 2021-11-06 16:56:25 · 165 阅读 · 0 评论 -
勾股定理(计算)C++
输入两条直角边长,输出斜边长。#include <iostream>#include <cmath>#include <iomanip>using namespace std;double a, b, c;int main(){ cin >> a >> b; cout << fixed << setprecision(5) << sqrt(a * a + b * b) <<原创 2021-11-06 15:49:04 · 3186 阅读 · 0 评论 -
平面分割(公式法优化)
题目描述:平面上有n条封闭曲线,其中任何两条封闭曲线交于两点,且任何三条曲线不交于同一点,计算这些封闭曲线分割的区域个数。输入样例3输出样例8问题分析F(n) = n*n - n + 2;CODE#include<bits/stdc++.h>using namespace std;int n;int main(){ freopen("plane.in","r",stdin); freopen("plane.out","w",stdout); ci原创 2021-10-31 16:37:07 · 302 阅读 · 1 评论 -
CF32B Borze(模拟+字符串)(大佬勿喷)
题目描述Ternary numeric notation is quite popular in Berland. To telegraph the ternary number the Borze alphabet is used. Digit 0 is transmitted as «.», 1 as «-.» and 2 as «--». You are to decode the Borze code, i.e. to find out the ternary number given its原创 2021-10-16 17:55:00 · 365 阅读 · 4 评论 -
入门好题集(CodeForces)
洛谷:CF14A Letter题解CF16A Flag题解CF22A Second Order Statistics题解CF32B Borze题解原创 2021-10-31 16:36:47 · 313 阅读 · 0 评论 -
CF22A Second Order Statistics(字符串+哈希+桶排序 或STL中的set)
题目描述Once Bob needed to find the second order statistics of a sequence of integer numbers. Lets choose each number from the sequence exactly once and sort them. The value on the second position is the second order statistics of the given sequence. In ot..原创 2021-10-16 17:43:54 · 137 阅读 · 0 评论 -
CF16A Flag(模拟+字符串+暴力搜索)(大佬勿喷)
题目描述According to a new ISO standard, a flag of every country should have a chequered fieldn×mn×m, each square should be of one of 10 colours, and the flag should be «striped»: each horizontal row of the flag should contain squares of the same colour,...原创 2021-10-16 17:31:14 · 226 阅读 · 0 评论 -
CF14A Letter(模拟+字符串)(C++题解)(大佬勿喷)
题目描述A boy Bob likes to draw. Not long ago he bought a rectangular graph (checked) sheet withnnrows andmmcolumns. Bob shaded some of the squares on the sheet. Having seen his masterpiece, he decided to share it with his elder brother, who lives in Fla...原创 2021-10-16 17:14:59 · 383 阅读 · 0 评论 -
C++_递推_偶数个三
在所有的N位数中,有多少个数中有偶数个数字3(说明,0是偶数)?输入格式读入一个数N输出格式输出有多少个数中有偶数个数字3。输入样例2输出样例73(由于 位数 比较大的情况下,导致输出数据可能越界,因此,输出个数 % 12345 的结果)数据规模1<=N<=1000感谢网友提供的题目analysisa(1) = 1,b(1) = 8,递推即可CODE#include<bits/stdc++.h>using nam.原创 2021-10-16 15:15:01 · 674 阅读 · 0 评论 -
C++_STL_vector
1.vector的介绍STL中的一种容器,像stack,queue,map,set等2.vector的定义定义一个vector的方法如下vector<typename> name以上定义相当于定义了一个一维数组name [size] , 只是size不确定,可长可短,typename可以是各种数据类型,如int, char, double也可以这么定义:vector<int> a;vector<node> stu; // node原创 2021-10-16 14:02:49 · 143 阅读 · 0 评论 -
栈 C++详解(数据结构)
详解一像数组或链表一样,栈也是一种数据结构,它包含一系列元素。但是,与数组和链表不同的是,栈是一个后进先出(LIFO)的结构,这意味着当一个程序从栈中检索元素时,插入到栈中的最后一个元素是第一个被检索的元素(同样,插入的第一个元素是最后一个被检索的元素)。在想象一个栈的工作方式时,可以想象一下餐厅流水线开始时的一堆盘子。当餐厅的工作人员补充餐盘时,他或她放入的第一个盘子将是最后一个被取走的,如图 1 所示。图 1 栈的后进先出方式就像餐厅盘子的取用方式餐厅中一堆盘子的LIF.转载 2021-10-16 13:45:37 · 6013 阅读 · 1 评论 -
P1165 日志分析
题目描述M海运公司最近要对旗下仓库的货物进出情况进行统计。目前他们所拥有的唯一记录就是一个记录集装箱进出情况的日志。该日志记录了两类操作:第一类操作为集装箱入库操作,以及该次入库的集装箱重量;第二类操作为集装箱的出库操作。这些记录都严格按时间顺序排列。集装箱入库和出库的规则为先进后出,即每次出库操作出库的集装箱为当前在仓库里所有集装箱中最晚入库的集装箱。出于分析目的,分析人员在日志中随机插入了若干第三类操作――查询操作。分析日志时,每遇到一次查询操作,都要报告出当前仓库中最大集装箱的重量。输入.原创 2021-10-16 12:57:07 · 257 阅读 · 0 评论 -
279. 自然数拆分
给定一个自然数N,要求把N拆分成若干个正整数相加的形式,参与加法运算的数可以重复。注意:拆分方案不考虑顺序; 至少拆分成2个数的和。求拆分的方案数mod2147483648的结果。输入格式一个自然数N。输出格式输入一个整数,表示结果。数据范围1≤N≤40001≤N≤4000输入样例:7输出样例:14CODE#include <cstdio>#include <iostream>#include &...原创 2021-10-16 11:34:52 · 595 阅读 · 0 评论 -
C++ [贪心练习]小毛的交易(转载)
转载处:https://blog.csdn.net/drtlstf/article/details/83188484?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522163435445316780271542976%2522%252C%2522scm%2522%253A%252220140713.130102334..%2522%257D&request_id=163435445316780271542976&biz_id=0&转载 2021-10-16 11:24:27 · 130 阅读 · 0 评论 -
核电站递推c++
题目大意:一个核电站有N个放核物质的坑,坑排列在一条直线上。如果连续M个坑中放入核物质,则会发生爆炸,于是,在某些坑中可能不放核物质。对于给定的N和M,求不发生爆炸的放置核物质的方案数。样例输入:4 3//N和M;样例输出:13//方案数;样例解释:自己算。数据范围:目测tyvj无范围。。。还是rqnoj靠谱些。。。1< N <50,2<= M <=5;解题思路:数学?不会做。神犇自己加油。考虑动态规划。当i < ...转载 2021-10-15 18:10:00 · 1358 阅读 · 2 评论 -
IOI祝贺
经历了两个正式比赛日的激烈争夺,在6月28日结束的第33届国际信息学奥林匹克竞赛(IOI2021),中国队获得历史最佳战绩:包揽全球前四名,获四块金牌!以绝对优势取得团体第一,创造了IOI首次由一个国家的选手包揽前四名的历史。四名中国队选手分别为:邓明扬(中国人民大学附属中学);钱易(宁波市镇海中学)第二名;代晨昕(广州市第二中学);虞皓翔(宁波市镇海中学)。其中排名第一的邓明扬以满分600分夺冠,这也是中国选手时隔4年重回“世界第一”宝座。上一个满分中国选手是2014年的杭州学军中学高二学原创 2021-10-14 21:15:41 · 146 阅读 · 2 评论 -
define用法
宏定义命令,其主要目的是为程序员在编程时提供一定的方便,并能在一定程度上提高程序的运行效率,但学生在学习时往往不能 理解该命令的本质,总是在此处产生一些困惑,在编程时误用该命令,使得程序的运行与预期的目的不一致,或者在读别人写的程序时,把运行结果理解错误,这对 C语言的学习很不利。1 #define命令剖析1.1 #define的概念#define命令是C语言中的一个宏定义命令,它用来将一个标识符定义为一个字符串,该标识符被称为宏名,被定义的字符串称为替换文本。该命令有两种格式:一种是简单的宏定义,原创 2021-10-14 21:11:57 · 831 阅读 · 0 评论 -
C++中<>与“ “的区别
difference<> 和 ""这个肯定不同,如果是库文件,最好用<>,因为如果你用"",编译器会先搜索用户自定义的头文件,搜索不到再到include目录下去找,这样在效率上肯定就慢了。自定义头文件只能用""include<iostream>using namespace std;是新的C++标准,cout和cin是在命名空间std中定义的,要用所以要加命名空间。你不用using namespace std用std::cout,std::cin也可以。suc原创 2021-10-13 20:54:28 · 816 阅读 · 0 评论 -
c++基本数据类型
基本类型数据类型指明变量或表达式的状态和行为,数据类型决定了数的取值范围和允许执行的运算符集。c++语言数据类型可以分为两大类:基本类型和引用类型。基本类型是指不能再分解的数据类型,其数据在函数的调用中是以传值方式工作的;引用类型有时也称复合类型,它是可以分解为基本类型的数据类型,其数据在函数调用中是以传址方式来工作的。[13]整型整数常量整数常量是不带小数的数值,用来表示正负数。例2—2中Ox55、0x55ff、1000000都是c++语言的整数常量。c++语言的整数常量有三种形式:.转载 2021-10-10 13:27:23 · 4354 阅读 · 0 评论 -
在word文档中插入代码
点击这里1,在左边插入代码2,点击高亮即可3,复制到 word 上原创 2021-10-10 11:06:47 · 572 阅读 · 0 评论 -
C++ 加速 cin 和 cout
ios::sync_with_stdio(false);cin.tie(0); 在输入大数据的时候可以快很多很多很很多;原创 2021-10-10 10:41:52 · 255 阅读 · 2 评论 -
#3. 复读机(LibreOJ)
题目描述输入一些正整数,将它们原样输出。提示这道题用于测试文件输入输出,请注意使用文件输入输出,而非标准输入输出。请将鼠标移至上方的文件 IO图标,查看输入输出文件名。输入格式第一行一个正整数,表示有组测试数据。接下来行,每行一个正整数。输出格式输出行,每行一个正整数。样例 1输入3123输出123样例 2输入11000000000000000000000000000000000输出复制100...原创 2021-10-10 10:15:27 · 904 阅读 · 1 评论 -
数的计数(递推)(vijos)
描述我们要求找出具有下列性质数的个数(包含输入的自然数nn)。先输入一个自然数n~(n\le 1000)n(n≤1000),然后对此自然数按照如下方法进行处理:1· 不作任何处理;2. 在它的左边加上一个自然数,但该自然数不能超过原数的一半;3. 加上数后,继续按此规则进行处理,直到不能再加自然数为止。格式输入格式自然数n输出格式满足条件的数的个数样例1样例输入16样例输出16样例说明满足条件的数为 6 (此部分不必输出)..原创 2021-10-10 09:57:44 · 306 阅读 · 0 评论 -
Victoria的舞会1
原题链接Victoria的舞会1 - Vijos描述Victoria是一位颇有成就的艺术家,他因油画作品《我爱北京天安门》闻名于世界。现在,他为了报答帮助他的同行们,准备开一个舞会。Victoria准备邀请n个已经确定的人,可是问题来了:这n个人每一个人都有一个小花名册,名册里面写着他所愿意交流的人的名字。比如说在A的人名单里写了B,那么表示A愿意与B交流;而且如果A名单里面有B,那么B名单里面肯定有A,也就是说两个人如果一方愿意和另一方交流,那么另一方也肯定愿意和这一方交流。Vict原创 2021-10-10 09:50:51 · 105 阅读 · 0 评论 -
CF58A Chat room
题目描述Vasya has recently learned to type and log on to the Internet. He immediately entered a chat room and decided to say hello to everybody. Vasya typed the wordss. It is considered that Vasya managed to say hello if several letters can be deleted from..原创 2021-10-05 13:57:32 · 117 阅读 · 0 评论 -
CHAT ROOM AC 记录
https://www.luogu.com.cn/record/59189439https://www.luogu.com.cn/record/59189439原创 2021-10-05 13:56:50 · 85 阅读 · 0 评论 -
CF59A Word
题目描述Vasya is very upset that many people on the Net mix uppercase and lowercase letters in one word. That's why he decided to invent an extension for his favorite browser that would change the letters' register in every word so that it either only consis原创 2021-10-05 13:43:51 · 102 阅读 · 0 评论 -
CF41A Translation(洛谷水题记)
题目描述The translation from the Berland language into the Birland language is not an easy task. Those languages are very similar: a berlandish word differs from a birlandish word with the same meaning a little: it is spelled (and pronounced) reversely. For原创 2021-10-04 20:18:59 · 210 阅读 · 0 评论 -
CF964A Splits(洛谷水题记)
题目描述Let's define a split ofnnas a nonincreasing sequence of positive integers, the sum of which isnn.For example, the following sequences are splits of88:[4, 4][4,4],[3, 3, 2][3,3,2],[2, 2, 1, 1, 1, 1][2,2,1,1,1,1],[5, 2, 1][5,2,1].The ...原创 2021-10-04 20:17:46 · 182 阅读 · 0 评论 -
CF63A Sinking Ship(洛谷水题记)
题目描述The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. Allnncrew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 tonn) and await further in...原创 2021-10-04 19:52:55 · 95 阅读 · 0 评论 -
CF46A Ball Game(洛谷水题记)
题目描述A kindergarten teacher Natalia Pavlovna has invented a new ball game. This game not only develops the children's physique, but also teaches them how to count.The game goes as follows. Kids stand in circle. Let's agree to think of the children as nu原创 2021-10-04 19:51:32 · 307 阅读 · 0 评论 -
CF4A Watermelon(洛谷水题记)
题目描述One hot summer day Pete and his friend Billy decided to buy a watermelon. They chose the biggest and the ripest one, in their opinion. After that the watermelon was weighed, and the scales showedwwkilos. They rushed home, dying of thirst, and decid..原创 2021-10-04 09:01:36 · 360 阅读 · 0 评论 -
CF1A Theatre Square(洛谷水题记)
题目描述Theatre Square in the capital city of Berland has a rectangular shape with the sizen×mn×mmeters. On the occasion of the city's anniversary, a decision was taken to pave the Square with square granite flagstones. Each flagstone is of the sizea×aa×a...原创 2021-10-04 09:00:22 · 469 阅读 · 0 评论 -
P1077 [NOIP2012 普及组] 摆花(洛谷水题记)
题目描述小明的花店新开张,为了吸引顾客,他想在花店的门口摆上一排花,共m盆。通过调查顾客的喜好,小明列出了顾客最喜欢的 n种花,从1到n标号。为了在门口展出更多种花,规定第ii种花不能超过ai盆,摆花时同一种花放在一起,且不同种类的花需按标号的从小到大的顺序依次摆列。试编程计算,一共有多少种不同的摆花方案。输入格式第一行包含两个正整数n和m,中间用一个空格隔开。第二行有n个整数,每两个整数之间用一个空格隔开,依次表示 ai。输出格式一个整数,表示...原创 2021-10-03 18:57:34 · 216 阅读 · 0 评论 -
665. 倍数(acwing水题记)
读取两个正整数值AA和BB。如果其中一个是另一个的整数倍,则输出Sao Multiplos,否则输出Nao sao Multiplos。输入格式共一行,两个整数AA和BB。输出格式按题目所述,输出结果。数据范围0<A,B<1000<A,B<100输入样例:6 24输出样例:Sao Multiplos难度:简单 时/空限制:1s / 64MB 总通过数:4674 总尝试数:7823 来源:语法题 ...原创 2021-10-03 14:23:47 · 291 阅读 · 1 评论 -
449. 质因数分解(acwing水题记)
已知正整数nn是两个不同的质数的乘积,试求出较大的那个质数。输入格式输入只有一行,包含一个正整数nn。输出格式输出只有一行,包含一个正整数pp,即较大的那个质数。数据范围6≤n≤2∗1096≤n≤2∗109输入样例:21输出样例:7CODE#include <iostream>using namespace std;int main(){ int n; scanf("%d", &n); for(int i=2; i...原创 2021-10-03 14:07:42 · 121 阅读 · 1 评论