编程基础
文章平均质量分 81
GoldenFingers
持之以恒!!!
展开
-
C/C++函数可变参量传递
函数的可变参量传递是什么呢?就是你设定的函数在传入参数的时候你不知道传入参数的数量和顺序。为了解决这个问题一般用两种办法,第一个就是函数重载,第二个就是使用可变参量。第一个方法也是使用最多的办法,但是第一个方法有一个问题就是只有在解决传入参量变化不是很大的时候才行,要是传入的参量从几个到几百个不等,那么要使用函数重载是不现实的。函数可变参量的传递其实学过C语言的都用过,最常见的就是printf函...原创 2020-04-06 09:13:51 · 770 阅读 · 0 评论 -
#ifdef、#ifndef、#endif功能及其应用
1、功能首先要知道#ifdef的功能,ifdef一看就是if define的缩写,其实就是一个条件判断语句,这个语句必须和#endif组合使用。看以下例句:#include <iostream>using namespace std;#define num 123int main() {#ifdef num //如果宏定义了num,则执行#ifdef和#endif之间的...原创 2020-03-29 18:01:33 · 810 阅读 · 2 评论 -
POJ:2674-Linear world(名字交换碰撞)
Linear worldTime Limit: 3000MS Memory Limit: 65536K Total Submissions: 4514 Accepted: 1025DescriptionThe Disc, being flat, has no real horizon. Any adventurous sailors who get funny ...原创 2018-05-07 09:35:06 · 254 阅读 · 0 评论 -
POJ:3684-Physics Experiment(弹性碰撞)
Physics ExperimentTime Limit: 1000MS Memory Limit: 65536K Total Submissions: 3392 Accepted: 1177 Special JudgeDescriptionSimon is doing a physics experiment with N identical bal...原创 2018-05-07 09:23:31 · 441 阅读 · 0 评论 -
POJ:3320-Jessica's Reading Problem(尺取法)
Jessica’s Reading ProblemTime Limit: 1000MS Memory Limit: 65536K Total Submissions: 15224 Accepted: 5241DescriptionJessica’s a very lovely girl wooed by lots of boys. Recently she...原创 2018-04-25 20:26:05 · 150 阅读 · 0 评论 -
POJ:3061-Subsequence(尺取法模板详解)
SubsequenceTime Limit: 1000MS Memory Limit: 65536K Total Submissions: 18795 Accepted: 8043DescriptionA sequence of N positive integers (10 < N < 100 000), each of them less ...原创 2018-04-25 20:00:23 · 275 阅读 · 0 评论 -
POJ:1222-EXTENDED LIGHTS OUT(矩阵反转)
EXTENDED LIGHTS OUTTime Limit: 1000MS Memory Limit: 10000K Total Submissions: 12956 Accepted: 8186DescriptionIn an extended version of the game Lights Out, is a puzzle with 5 rows...原创 2018-05-06 09:33:15 · 225 阅读 · 0 评论 -
POJ:3279-Fliptile(矩阵反转)
FliptileTime Limit: 2000MS Memory Limit: 65536K Total Submissions: 14701 Accepted: 5381DescriptionFarmer John knows that an intellectually satisfied cow is a happy cow who will gi...原创 2018-05-06 09:18:12 · 230 阅读 · 0 评论 -
POJ:3185-The Water Bowls(枚举反转)
The Water BowlsTime Limit: 1000MS Memory Limit: 65536K Total Submissions: 7402 Accepted: 2927DescriptionThe cows have a line of 20 water bowls from which they drink. The bowls can be...原创 2018-05-06 09:03:42 · 222 阅读 · 0 评论 -
POJ:3276-Face The Right Way(线性反转)
Face The Right WayTime Limit: 2000MS Memory Limit: 65536K Total Submissions: 6259 Accepted: 2898DescriptionFarmer John has arranged his N (1 ≤ N ≤ 5,000) cows in a row and many of th...原创 2018-05-05 19:51:40 · 181 阅读 · 0 评论 -
POJ:2100-Graveyard Design(尺取)
Graveyard DesignTime Limit: 10000MS Memory Limit: 64000K Total Submissions: 8504 Accepted: 2126 Case Time Limit: 2000MSDescriptionKing George has recently decided that he would like ...原创 2018-05-05 09:27:26 · 195 阅读 · 0 评论 -
POJ:2739-Sum of Consecutive Prime Numbers(尺取)
Sum of Consecutive Prime NumbersTime Limit: 1000MS Memory Limit: 65536K Total Submissions: 27853 Accepted: 14968DescriptionSome positive integers can be represented by a sum of on...原创 2018-05-05 09:15:05 · 111 阅读 · 0 评论 -
POJ:2566-Bound Found(尺取变形好题)
Bound FoundTime Limit: 5000MS Memory Limit: 65536K Total Submissions: 5408 Accepted: 1735 Special JudgeDescriptionSignals of most probably extra-terrestrial origin have been rec...原创 2018-05-04 17:42:44 · 213 阅读 · 0 评论 -
POJ:3977-Subset(双向搜索)
SubsetTime Limit: 30000MS Memory Limit: 65536K Total Submissions: 5961 Accepted: 1129DescriptionGiven a list of N integers with absolute values no larger than 1015, find a non empty s...原创 2018-05-13 10:21:00 · 245 阅读 · 0 评论 -
POJ:2785-4 Values whose Sum is 0(双向搜索)
4 Values whose Sum is 0Time Limit: 15000MS Memory Limit: 228000K Total Submissions: 26974 Accepted: 8133 Case Time Limit: 5000MSDescriptionThe SUM problem can be formulated as fol...原创 2018-05-11 16:40:47 · 157 阅读 · 0 评论 -
Codeforces Round #464 (Div. 2) B. Hamster Farm
B. Hamster Farmtime limit per test2 seconds memory limit per test256 megabytesProblem DescriptionDima has a hamsters farm. Soon N hamsters will grow up on it and Dima will sell them in a city...原创 2018-03-01 15:04:38 · 233 阅读 · 0 评论 -
堆和栈及其实现方法
关于堆和栈- 以前学习程序设计的时候都是将堆栈合起来一起说的,后来经过很久以后的学才发现堆栈完全是两个东西,也不知道为什么要将堆栈合起来一起说,栈很好理解,就是一个先进后出表,但是堆是一种数据结构。感觉栈和队列可以合起来说,但是堆明显是不能和堆合起来说的。首先是栈,栈很好理解,就和它的名字一样先进后出表...原创 2018-03-08 08:54:23 · 679 阅读 · 0 评论 -
关于各种排序(插入,冒泡,选择,希尔)
插入排序:能快速处理相对有序的数据,最优情况下复杂度仅仅为O(n)(即原本就是有序的数列);#includeusing namespace std;const int maxn = 100;int num[maxn];void InsertionSort(int n){ for(int i=1;i<n;i++) { int j = i-1;原创 2017-10-28 14:41:29 · 238 阅读 · 0 评论