题目:有两种操作:1.当前数值增加;2.输出当前数值。
分析:简单题。模拟即可。
说明:A+B。
#include
#include
#include
using namespace std;
string s;
int main()
{
int n,sum,add;
while (cin >> n) {
sum = 0;
while (n --) {
cin ...
分类:
其他好文 时间:
2014-10-13 00:41:28
阅读次数:
482
partial,写在类的class前面。它代表,此处写得类是类的一部份,还可以继续用partial class来补充类的其它部分。一、属性:类中的方法(函数)一般有三类:构造方法,属性方法,行为方法。public 类型 属性名{ get { return ...; } set { ... = v.....
分类:
其他好文 时间:
2014-10-13 00:00:58
阅读次数:
229
JQuery data 接口是什么?.data()Store arbitrary data associated with the matched elements or return the value at the named data store for the first element i...
Pascal's TriangleGivennumRows, generate the firstnumRowsof Pascal's triangle.For example, givennumRows= 5,Return[ [1], [1,1], [1,2,1], [1,3,...
分类:
其他好文 时间:
2014-10-12 23:31:28
阅读次数:
152
Problem:Reverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321终于什么都没参考就一次Accept了。可能是这题比较简单,同时自己也进步了一点点,leetcode就是这样给我...
分类:
其他好文 时间:
2014-10-12 22:55:28
阅读次数:
151
iostream是一个类,有自己的buffer。你每次cin>>a,它就把buffer减一,放到a中去。cin.putback(a)就是把a的内容放回buffer中。例1:读出来之后,再放回去,让别人也可以读:譬如输入了 'm '; cin> > a; cin> > b; 此时a= 'm ',b等待...
分类:
其他好文 时间:
2014-10-12 22:46:08
阅读次数:
357
Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.
For example,
If n = 4 and k = 2, a solution is:
[
[2,4],
[3,4],
[2,3],
[1,2],
[1,3],
[1,4],
]...
分类:
其他好文 时间:
2014-10-12 20:53:58
阅读次数:
191
Follow up for "Remove Duplicates":
What if duplicates are allowed at most twice?
For example,
Given sorted array A = [1,1,1,2,2,3],
Your function should return length = 5, and A is now [1,1,2,...
分类:
其他好文 时间:
2014-10-12 19:42:38
阅读次数:
141
Given a set of distinct integers, S, return all possible subsets.
Note:
Elements in a subset must be in non-descending order.The solution set must not contain duplicate subsets.
For exa...
分类:
其他好文 时间:
2014-10-12 18:17:08
阅读次数:
242
题目链接:ZOJ 3827 Information Entropy
根据题目的公式算吧,那个极限是0
AC代码:
#include
#include
#include
const double e=exp(1.0);
double find(char op[])
{
if(op[0]=='b')
return 2.0;
else if(o...
分类:
其他好文 时间:
2014-10-12 17:59:48
阅读次数:
156