- 博客(9)
- 资源 (1)
- 收藏
- 关注
原创 C++中从文件中读出字符流,以及向文件中输入字符流
#include #include #include #include //读文件using namespace std;int main(){ ifstream f; f.open("file1.txt"); string s; vector vec; //getline第三个参数表示终止符 while(getline(f, s, '\n')) //fscanf()
2015-04-25 20:06:28 720
转载 13、Roman to Integer
//罗马数字转换为阿拉伯整型#include #include using namespace std;class Solution {public: int map_c(const char c) { switch(c) { case 'I': return 1; case 'V': return 5; case 'X': return 10;
2015-04-03 16:59:57 412
转载 12、Integer to Roman
//注意罗马数字的表示方法#include #include using namespace std;class Solution {public: string intToRoman(int num) { if(num == 0) return 0; string re; //为什么4, 9, 40, 900等会出现, 是应为一个罗马数
2015-04-03 16:56:56 455
转载 11、Container with most water
大概是要找到条纵线然后这两条线以及X轴构成的容器能容纳最多的水。下面以例子: [4,6,2,6,7,11,2] 来讲解。1.首先假设我们找到能取最大容积的纵线为 i , j (假定i2.下面我们看这么一条性质:①: 在 j 的右端没有一条线会比它高! 假设存在 k |( j aj) ,那么 由 ak> aj,所以 min( ai,aj, ak) =min(ai
2015-04-03 13:58:18 353
原创 centos6.5 安装 Qt5.3.2
直奔主题吧,安装之前,先看看gcc的版本,gcc-v , g++ -v 如果是4.4.7的话建议更新到4.8.2, 如果没有安装g++的话, 建议 yum install gcc gcc-c++ 然后下载源码升级到4.8.2, 网上有很多教程,吐槽一下,其中make占用了很长时间之后就是在http://www.qt.io/download/ 下载Qt了, 自己玩的话一般安装f
2014-12-06 20:26:56 1369
原创 UVa - 445 - Marvelous Mazes(AC)
Your mission, if you decide to accept it, is to create a maze drawing program. A maze will consist of the alphabetic characters A-Z, * (asterisk), and spaces.Input and OutputYour program will ge
2014-11-17 19:05:51 418
原创 UVa - 414 - Machined Surfaces(AC)
An imaging device furnishes digital images of two machined surfaces that eventually will be assembled in contact with each other. The roughness of this final contact is to be estimated.A digital i
2014-11-15 22:21:32 1789
原创 UVa - 490 - Rotating Sentences (AC)
In ``Rotating Sentences,'' you are asked to rotate a series of input sentences 90 degrees clockwise. So instead of displaying the input sentences from left to right and top to bottom, your program wil
2014-11-15 20:08:36 504
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人