- 博客(42)
- 资源 (3)
- 收藏
- 关注
转载 C++中const的实现机制深入分析
C++中const的实现机制深入分析C语言以及C++语言中的const究竟表示什么?其具体的实现机制又是如何实现的呢?本文将对这两个问题进行一些分析,需要了解的朋友可以参考下问题 C语言以及C++语言中的const究竟表示什么?其具体的实现机制又是如何实现的呢? 本文将对这两个问题进行一些分析,简单解释const的含义以及实现
2014-09-20 09:15:52 390
原创 2.2.2---Subset Sums (01)
For many sets of consecutive integers from 1 through N (1 For example, if N=3, one can partition the set {1, 2, 3} in one way so that the sums of both subsets are identical:{3} and {1,2}This
2013-06-01 14:45:19 362
原创 2.2.1---Preface Numbering
A certain book's prefaces are numbered in upper case Roman numerals. Traditional Roman numeral values use a single letter to represent a certain subset of decimal numbers. Here is the standard set:
2013-05-01 17:10:43 439
原创 2.1.2---Ordered Fractions
Consider the set of all reduced fractions between 0 and 1 inclusive with denominators less than or equal to N.Here is the set when N = 5:0/1 1/5 1/4 1/3 2/5 1/2 3/5 2/3 3/4 4/5 1/1Write a progr
2013-05-01 14:59:04 462
原创 2.1.5---Hamming Codes
Given N, B, and D: Find a set of N codewords (1 <= N <= 64), each of length B bits (1 <= B <= 8), such that each of the codewords is at least Hamming distance of D (1 <= D <= 7) away from each of the
2013-05-01 14:54:04 525
原创 2.1.4---Healthy Holsteins
Farmer John prides himself on having the healthiest dairy cows in the world. He knows the vitamin content for one scoop of each feed type and the minimum daily vitamin requirement for the cows. Help F
2013-05-01 13:08:17 508
原创 2.1.3---Sorting a Three-Valued Sequence
Sorting is one of the most frequently performed computational tasks. Consider the special sorting problem in which the records to be sorted have at mostthree different key values. This happens for ins
2013-04-30 16:30:48 406
原创 2.1.1---The Castle
In a stroke of luck almost beyond imagination, Farmer John was sent a ticket to the Irish Sweepstakes (really a lottery) for his birthday. This ticket turned out to have only the winning number for th
2013-04-30 13:35:16 358
原创 1.5.4---Checker Challenge
Examine the 6x6 checkerboard below and note that the six checkers are arranged on the board so that one and only one is placed in each row and each column, and there is never more than one in any diag
2013-04-25 20:28:20 373
原创 1.5.3---Superprime Rib
Butchering Farmer John's cows always yields the best prime rib. You can tell prime ribs by looking at the digits lovingly stamped across them, one by one, by FJ and the USDA. Farmer John ensures that
2013-04-24 19:42:39 477
转载 C++中STRING转为INT (转)
1 #include string str="12345"; int b=atoi(str.c_str()); 2【转】C++ int,char,string,CString类型转换(整理总结)#include //使用C++标准库的string类时using namespace std; //同上#incl
2013-04-23 20:28:51 515
原创 1.5.1---Number Triangles
Consider the number triangle shown below. Write a program that calculates the highest sum of numbers that can be passed on a route that starts at the top and ends somewhere on the base. Each step can
2013-04-23 10:48:28 350
原创 1.4.4---Mother's Milk
Farmer John has three milking buckets of capacity A, B, and C liters. Each of the numbers A, B, and C is an integer from 1 through 20, inclusive. Initially, buckets A and B are empty while bucket C is
2013-04-23 10:10:39 464
原创 1.4.3---Arithmetic Progressions
An arithmetic progression is a sequence of the form a, a+b, a+2b, ..., a+nb where n=0,1,2,3,... . For this problem, a is a non-negative integer and b is a positive integer.Write a program that finds
2013-04-21 18:04:53 476
原创 1.4.2---The Clocks
The ClocksIOI'94 - Day 2Consider nine clocks arranged in a 3x3 array thusly:|-------| |-------| |-------| | | | | | | | |---O | |---O | | O |
2013-04-20 11:08:04 485
原创 next_permutation全排列算法
C++ STL中的一个可以方便的生成全排列的算法:#include bool next_permutation( iterator start, iterator end );使用举例:#include #include #include using namespace std; int main(){ string str;
2013-04-20 09:24:47 413
原创 Pick Apples
Problem DescriptionA long time ago, there was another Garden of Eden which produces three kinds of apples. The number of them were infinite.Each kind of apple had Si size and Pi value.One day, Ada
2013-04-13 14:04:05 1043
原创 Battle
Problem Description In the land of League of Legends ruled some kingdoms.The land had a rectangular form and each kingdom was a sub-rectangle.These kingdoms had developed a strange rivalry: the f
2013-04-13 11:30:09 430
原创 Water Bills
DescriptionIt's 30 century. And water has become very expensive. Recently, your water company raised the rates once more. The table below shows the new rates (consumption is always a positive in
2013-04-13 10:31:30 747
原创 Stone Problem
Problem Description There is an new stone game, played on an arbitrary general tree. The goal is to put one stone on the root of tree observing the following rules: 1.people can only put ston
2013-04-13 09:55:24 485
原创 Dinner Hall
DescriptionThere is a restaurant and a waitress who's task is to record in a card the time whenever a concumer enter or exit the restaurant int the format HH:MM:SS C (C is the event which can be le
2013-04-12 23:17:25 1206
原创 1.3.2---Barn Repair
Barn RepairIt was a dark and stormy night that ripped the roof and gates off the stalls that hold Farmer John's cows. Happily, many of the cows were on vacation, so the barn was not completely ful
2013-04-08 22:01:36 408
原创 1.2.4---Palindromic Squares
Palindromes are numbers that read the same forwards as backwards. The number 12321 is a typical palindrome.Given a number base B (2 <= B <= 20 base 10), print all the integers N (1 <= N <= 300 bas
2013-04-05 22:38:22 374
原创 1.2.3---Name That Number
Among the large Wisconsin cattle ranchers, it is customary to brand cows with serial numbers to please the Accounting Department. The cow hands don't appreciate the advantage of this filing system, th
2013-04-05 22:06:30 338
原创 笔记---浮点数运算的陷阱
本文开始之前大家先看一道题目吧:#includeint main(){ double i; for(i=0;i!=10;i+=0.1) printf("%.1lf\n",i); return 0;}运行结果是什么呢?不要凭感觉,亲自试一试就会发现这是无限循环的,为啥呢?这就是浮点
2013-04-05 18:37:32 592
原创 笔记--64位整数
首先,还是先看一道题目吧:输入正整数n,统计它的正因子个数。n≤10^12。例如n=30时,输出8。简单的想,其实直接枚举不会超时。因为如果i为n的约数,那么n/i也是n的约数。除去i=n/i的情况,i和n/i恰好有一个不超过n的算术平方根。所以,从1枚举到即可。当然还有一个细节要十分注意,那就是n太大了,超出了int类型的表示范围。其实还有一种比int更大的类型,那就是long lo
2013-04-05 18:37:00 930
原创 笔记——字符串输入的细节问题
首先附上最近一次比赛的题目一枚This week, CSDN network's database was hacked by somebody and six million usernames and passwords have been spread through Internet. As a programmer who registered on CSDN in the
2013-04-05 18:36:25 589
转载 笔记--rand()
大家都知道C语言中的随机函数random,可是random函数并不是ANSI C标准,所以说,random函数不能在gcc,vc等编译器下编译通过。那么怎么实现VC语言中的随机函数呢?其实,除了random函数,还有一个rand函数,这个函数也是一个随机函数,他可以产生从0到rand_max(32767)的随机数。#i nclude#i ncludeint main
2013-04-05 18:35:36 383
原创 C++课程设计总结
最近为了课设过了一段野人般的生活…我也是初步学习MFC,所以很多东西都不甚了解,很多技巧和用法都是综合各家之言而成…有什么不确切的地方,希望大家指正…… 首先介绍一下我的程序,没有想到新颖的课题,就做了人事档案管理系统,这个系统最主要的就是连接操作数据库,我就以自己工作的顺序介绍一下。 一、准备工作我建立的是单文档工程,虽然没用单文档界面(还是以对话框为主),但是
2013-04-05 18:34:47 2283
原创 课设补充
之前总结的遗漏部分,发现用的还挺频繁,粘在这里方便参考,格式很不严谨,大家看也勿抠代码,会意为主。1.列表控件删除记录 int nCurSel =m_xiugai_list.GetNextItem(-1,LVNI_SELECTED);//m_xiugai_list是我设置的列表控件对应的变量if(nCurSel == -1 ){MessageBox("没有选择修改数据!");
2013-04-05 18:33:24 891
原创 数据结构基础+STL--字典翻译
DescriptionYou have justmoved from Waterloo to a big city. The people here speak an incomprehensibledialect of a foreign language. Fortunately, you have a dictionary to help youunderstand them.Inp
2013-04-05 18:29:56 540
原创 数据结构基础+STL--符号匹配
You are given astring consisting of parentheses () and []. A string of this type is said to be correct:(a)if it is the empty string(b)if A and B are correct, AB is correct,(c)if A is cor
2013-04-05 18:28:37 512
原创 数据结构基础+STL--第k大
DescriptionXiao Ming andXiao Bao are playing a simple Numbers game. In a round Xiao Ming can choose towrite down a number, or ask Xiao Bao what the kth great number is. Because thenumber written by
2013-04-05 18:27:55 445
原创 数据结构基础+STL--winner map
DescriptionThe winner ofthe card game popular in Berland "Berlogging" is determined accordingto the following rules. If at the end of the game there is only one player withthe maximum number of poin
2013-04-05 18:27:03 417
原创 数据结构基础+STL--tree recovery
DescriptionLittle Valentineliked playing with binary trees very much. Her favorite game was constructingrandomly looking binary trees with capital letters in the nodes. This is an example of one o
2013-04-05 18:26:11 418
原创 数据结构基础+STL--sequence
DescriptionGiven msequences, each contains n non-negative integer. Now we may select one numberfrom each sequence to form a sequence with m integers. It's clear that we mayget n ^ m this kind of seq
2013-04-05 18:25:07 489
原创 基础算法--C快速排序
Description给你n个整数,请按从大到小的顺序输出其中前m大的数。Input每组测试数据有两行,第一行有两个数n,m(0,第二行包含n个各不相同,且都处于区间[-500000,500000]的整数。Output对每组测试数据按从大到小的顺序输出前m大的数。Sample Input5 33 -35 92 213-644Sample Output213
2013-04-05 18:24:22 405
原创 基础算法--B最大字段和
DescriptionGiven a sequencea[1],a[2],a[3]......a[n], your job is to calculate the max sum of asub-sequence. For example, given (6,-1,5,4,-7), the max sum in this sequence is6 + (-1) + 5 + 4 = 14.I
2013-04-05 18:23:35 453
原创 基础算法--A一只小蜜蜂 裴波那契数列
输入数据的第一行是一个整数N,表示测试实例的个数,然后是N行数据,每行包含两个整数a和b(0。 Output对于每个测试实例,请输出蜜蜂从蜂房a爬到蜂房b的可能路线数,每个实例的输出占一行。 Sample Input21 23 6 Sample Output13明显的裴波那契数列,每个蜂房都与标号相邻的两个蜂房相邻。则NUM(B)=NUM(
2013-04-05 18:22:13 572
原创 1.1.1---Greedy Gift Givers
Greedy Gift GiversA group of NP (2 ≤ NP ≤ 10)uniquely named friends has decided to exchange gifts of money. Each of thesefriends might or might not give some money to any or all of the other friends
2013-04-05 18:07:32 437
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人