ASCII和二进制文件的输入输出First:包含头文件#include ASCII输入:
首先要创建一个in-stream对象:ifstream fin("input.txt"); 逐词读取:fin>>num>>s;
读取过程中遇到空白符,>>操作符就会停止读取内容,知道遇到另一个>...
分类:
其他好文 时间:
2014-05-26 22:15:05
阅读次数:
593
Given a set of candidate numbers (C) and a
target number (T), find all unique combinations inCwhere the candidate numbers
sums toT.Thesamerepeated num...
分类:
其他好文 时间:
2014-05-26 13:54:25
阅读次数:
282
基本上一次过,要注意边界条件的问题:如果在recursion里有两个参数int begin, end,
递归写作recursion(num, mid+1, end), 因为+号的原因,递归中是会出现begin > end
的情况的,所以考虑初始条件的时候应该要考虑充分。 1 /** 2 * Def....
分类:
其他好文 时间:
2014-05-26 12:12:49
阅读次数:
257
'''
【程序71】
题目:编写input()和output()函数输入,输出5个学生的数据记录。
1.程序分析:
2.程序源代码:
使用list来模拟结构(不使用class)
stu = [string,string,list]
'''
N = 3
#stu
# num : string
# name : string
# score[4]: list
student =...
分类:
编程语言 时间:
2014-05-26 04:11:00
阅读次数:
440
[Submit][Status][Web
Board]
Description
Student类含有私有数据成员:num,name,sex,公有成员函数: 输入函数get_value()和输出函数display()。采用公用继承方式实现类Student1,增加数据成员:age,addr,成员函数:get_value_1()和display_1()。在程序运行时输入num,n...
分类:
其他好文 时间:
2014-05-24 22:12:09
阅读次数:
309
原题:http://acm.timus.ru/problem.aspx?space=1&num=18261826. MinefieldTime
limit: 0.5 secondMemory limit: 64 MBTo fulfill an assignment, a
reconnaissance...
分类:
其他好文 时间:
2014-05-24 12:57:02
阅读次数:
282
http://acm.timus.ru/problem.aspx?space=1&num=18241824.
Ifrit BomberTime limit: 0.5 second Memory limit: 64 MBIn the six years that
passed since the fi...
分类:
其他好文 时间:
2014-05-24 11:46:13
阅读次数:
298
1 #include 2 using namespace std; 3 4 int main() {
5 bool isPalindromic (int num); 6 int res = 0; 7 8 for(int i = 100; i res)11 ...
分类:
其他好文 时间:
2014-05-24 09:26:42
阅读次数:
168
刷了这么长时间POJ了 可算看到了一个中文题,不容易啊~~。
题目大意:自己看。
解题思路:
dp[x1][y1][x2][y2][num]代表从(x1,y1)到(x2,y2)分成num+1块最小的平方和是多少。
下面是代码:
#include
#include
#include
int sum[10][10],board[10][10];
d...
分类:
其他好文 时间:
2014-05-22 23:06:07
阅读次数:
300
这几个题很典型也是国外一些知名公司经常会问到的题
3Sum:
排序,避免重复,时间复杂度O(n^2)
class Solution {
public:
vector > threeSum(vector &num) {
int len=num.size();
sort(num.begin(),num.begin()+len);...
分类:
其他好文 时间:
2014-05-22 17:25:02
阅读次数:
259