![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
c++基础知识
文章平均质量分 63
black-hole6
这个作者很懒,什么都没留下…
展开
-
C++ 实验一 创建CDate类
代码:#include <iostream>#include <algorithm>#include <cstring>#include <cstdio>using namespace std;class CDate{private: int year, month, day;public: CDate()...原创 2019-11-01 10:01:36 · 730 阅读 · 0 评论 -
蓝桥杯国赛之阶乘位数
题目:阶乘位数9的阶乘等于:362880它的二进制表示为:1011000100110000000这个数字共有19位。请你计算,9999 的阶乘的二进制表示一共有多少位?注意:需要提交的是一个整数,不要填写任何无关内容(比如说明解释等)思路:把每一个数都用2的x的方,然后把2的指数加起来就可以了,最后取整代码:#include<cstdio>#incl...原创 2019-04-26 23:06:58 · 523 阅读 · 0 评论 -
Permutation(构造+思维)
A permutation p is an ordered group of numbers p1, p2, ..., pn, consisting of ndistinct positive integers, each is no more than n. We'll define number n as the length of permutation p1, p2, ...原创 2019-02-17 19:42:36 · 485 阅读 · 0 评论 -
CodeForces - 796B-Find The Bone(模拟)
Zane the wizard is going to perform a magic show shuffling the cups.There are n cups, numbered from 1 to n, placed along the x-axis on a table that has m holes on it. More precisely, cup i is on the...原创 2018-12-18 11:09:30 · 266 阅读 · 0 评论 -
UVA - 10815
Andy, 8, has a dream - he wants to produce his very own dictionary. This is not an easy task for him, as the number of words that he knows is, well, not quite enough. Instead of thinking up all the wo...原创 2018-11-22 10:55:17 · 229 阅读 · 0 评论 -
关于c语言的位运算&,|,^(看懂汉字的都能看懂)
其中|,&可以当作逻辑运算符,当|,&当成逻辑运算符时,与||,&&的用法基本相似,&&,||运算时会当前面的表达式能够决定整个表达式,则不进行对后面的判断,如:1&&1,1||0,当表达式前面的已经决定了整个表达式,则不需要进行判断后面的表达式的真假,而|,&无论前面的表达式的真伪,都要对后面进行判断。故由此也可以看出在进行...原创 2018-10-25 20:42:34 · 399 阅读 · 0 评论 -
c++中STL中的next_permutation函数基本用法
对于next_permutation函数是针对于排列组合问题的库函数,它的排序方式是按照字典的方式排列的·:如以下代码对于next_permutation函数的初步解释:#include<cstdio>#include<cstring>#include<algorithm>#include<iostream>using namesp...原创 2018-10-18 10:31:18 · 681 阅读 · 0 评论 -
void类型指针的基本用法
void作为指针时可以用任意类型的的指针值都可以给它进行赋值和传递,但是输出时必须时显性输出代码如下:#include<cstdio>#include<iostream>#include<algorithm>using namespace std;int main(){ char a='s'; int m=456;...原创 2018-09-25 21:45:11 · 3100 阅读 · 1 评论 -
关于c++中const的基本用法
c++中的const 有点类似于c里的宏定义#define,但是似乎是在宏定义基础上的代码优化,具体我解释不清,下面主要提到的是const 在c++中的3中基本用法:1.指向常量的指针例如:const char* pc=“sada";含义:声明一个名为pc的指针变量,它指向一个字符型常量,初始化pc为指向字符串"sada";由于指针指向的是一个字符型常量,const不允许改变...原创 2018-09-25 20:42:33 · 339 阅读 · 0 评论