1 pair的应用
pair是将2个数据组合成一个数据,当需要这样的需求时就可以使用pair,如stl中的map就是将key和value放在一起来保存。另一个应用是,当一个函数需要返回2个数据的时候,可以选择pair。 pair的实现是一个结构体,主要的两个成员变量是first second 因为是使用struct不是class,所以可以直接使用pair的成员变量。
2 make_pair函数...
分类:
编程语言 时间:
2015-03-15 16:56:10
阅读次数:
185
302. BHTML 1.0
Time limit per test: 0.25 second(s)
Memory limit: 65536 kilobytes
input: standard
output: standard
The hypertext markup language BHTML 1.0 has only two paired tags. They ar...
分类:
Web程序 时间:
2015-03-15 13:58:10
阅读次数:
201
The stringAPPAPTcontains twoPAT's as substrings. The first one is formed by the 2nd, the 4th, and the 6th characters, and the second one is formed by ...
分类:
其他好文 时间:
2015-03-14 23:04:31
阅读次数:
405
乘除都在150以内,分解质因数后发现只有35个,建立35个树状数组/线段树,做区间加、区间查询,最后快速幂起来。#include#includeusing namespace std;#define N 50001typedef long long ll;ll Quick_Pow(ll a,ll p...
分类:
编程语言 时间:
2015-03-14 20:02:55
阅读次数:
213
传送门1293 - Document Analyzer PDF (English) Statistics Forum Time Limit: 3 second(s)Memory Limit: 32 MBYou work in a leading software development comp.....
分类:
其他好文 时间:
2015-03-14 10:59:04
阅读次数:
143
题目:Girls and BoysTime Limit: 20000/10000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 189 Accepted Submission(s): 127 Problem Descriptionthe second year of the univer...
分类:
其他好文 时间:
2015-03-13 12:41:01
阅读次数:
120
1196. History Exam
Time limit: 1.5 second
Memory limit: 64 MB
Professor of history decided to simplify the examination process. At the exam, every student should write a list of historic ...
分类:
其他好文 时间:
2015-03-12 19:19:49
阅读次数:
164
针对多列表嵌套,如何获取所有元素?之前使用for循环+if判断,进行分解,如下:forfirst_layerinlists:ifisinstance(first_layer,list):forsecond_layerinfirst_layer:ifisinstance(second_layer,list):forthird_layerinsecond_layer:printthird_layerelse:printfirst_layer但..
分类:
编程语言 时间:
2015-03-12 15:19:45
阅读次数:
119
一个应用程序是有很多活动构成的,使用Intent在活动间移动。Intent分为显式和隐式两种:1.显示Intent:新建一个布局文件,命名为second_layout.xml,代码如下 然后新建一个后动SecondActivity继承于Activity,代码如下:package com.gui...
分类:
移动开发 时间:
2015-03-11 21:27:48
阅读次数:
171
题意:N个数,找出第二大的数。如果没有输出-1。思路:UNIQUE的使用。代码:int a[105];int n;int main(){ cin>>n; rep(i,0,n-1) cin>>a[i]; sort(a,a+n); int t=unique(a,a+n)-a; ...
分类:
其他好文 时间:
2015-03-11 16:19:46
阅读次数:
104