相关分类: Java技术 C/C++ VB delphi
  • Codeforces Round #369 (Div. 2)---C - Coloring Tree

    题目链接 http://codeforces.com/contest/711/problem/C Description ZS the Coder and Chris the Baboon has arrived at Udayland! They walked in the park where n trees grow. They decided to be naughty and color the trees in the park. The trees are numbere...

    2018-06-17 23:49:59

  • Sum of Two Integers

    Calculate the sum of two integers a and b , but you arenot allowedto use the operator + and - . Example: Given a = 1 and b = 2, return 3. 个人思路:绕开+、-,利用循环和 += 与 -= 。 class Solution { public : int getSum( int a, int b) { double x = a,...

    2018-06-17 23:49:59

  • C/C++字符串查找函数

    C/C++ string库( string .h)提供了几个字符串查找函数,如下:memchr 在指定内存里定位给定字符 strchr 在指定字符串里定位给定字符 strcspn 返回在字符串str1里找到字符串str2里的任意一个字符之前已查找的字符数量 strrchr 在字符串里定位给定字符最后一次出现的位...

    2018-06-17 23:49:52

  • lower_bound和upper_bound算法

    STL中的每个算法都非常精妙,接下来的几天我想集中学习一下STL中的算法。 ForwardIterlower_bound(ForwardIter first, ForwardIter last,const _Tp val)算法返回一个非递减序列[first, last)中的第一个大于等于值val的位置。 ForwardIter upper_bound(ForwardIter firs...

    2018-06-17 23:49:47

  • 初学C++之自定义类型名简化

    说明:本人使用的是vc++ IDE:vs2013 我在自定义一些类时,有时会取一些很长的名字,但是这不利于使用,这个时候就可以使用类型名简化。 class MathAddBBBB{}; using MAB = MathAddBBBB; 除了使用using之外,我们还可以使用typedef来定义: typedef MathAddBBBB mab;ma...

    2018-06-17 23:49:38

  • C++中的STL中map用法详解

    Map是STL的一个关联容器,它提供一对一(其中第一个可以称为关键字,每个关键字只能在map中出现一次,第二个可能称为该关键字的值)的数据处理能力,由于这个特性,它完成有可能在我们处理一对一数据的时候,在编程上提供快速通道。这里说下map内部数据的组织,map内部...

    2018-06-17 23:49:38

  • Qt拖放功能

    mytextedit.h: 1 #ifndef MYTEXTEDIT_H 2 #define MYTEXTEDIT_H 3 4 #include QTextEdit 5 #include " ui_mytextedit.h " 6 #include QUrl 7 #include QDropEvent 8 #include QMimeData 9 #include QString 10 #include QDragEnterEvent 11 12 class MyTextEdit : pub...

    2018-06-17 23:49:27

  • C++ 简单的任务队列

    任务队列是指能够实现任务在多线程间安全传递的先入先出的队列。 任务是指组合了数据和操作的对象,这里面定义为CTask类的对象。 任务的实现: Task.cpp 1 #include " stdafx.h " 2 #include " Task.h " 3 #include iostream 4 using namespace std; 5 6 CTask::CTask(...

    2018-06-17 23:49:28

  • 2016年湖南省第十二届大学生计算机程序设计竞赛---Par

    原题链接 http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1809 Description Bobo has a balanced parenthesis sequence P=p1p2pnof length n and q questions. The i-th question is whether P remains balanced after paiand pbiswapped. Note that questions are...

    2018-06-17 23:49:27

  • 2015-2016 ACM-ICPC Nordic Collegiate Programming C

    提交链接 http://codeforces.com/gym/100781/submit Description: Ada, Bertrand and Charles often argue over which TV shows to watch, and to avoid some of their fights they have finally decided to buy a video tape recorder. This fabulous, new device ca...

    2018-06-17 23:49:18

2