#include
#include
#include
using namespace std;
int main()
{
vector spvec;
string str;
while(cin>>str)
{
string *sp = new string;
*sp = str;
spvec.push_bac...
分类:
编程语言 时间:
2015-05-07 22:14:45
阅读次数:
168
#include
#include
#include
using namespace std;
struct CarType
{
string maker;
int year;
float price;
};
//使用这样的宏定义还有着可移植性的优势,所有的C编译器都支持它。
#define EXAMPLE1 struct CarType *
//很多编译器不支持如下方法
type...
分类:
其他好文 时间:
2015-05-07 22:01:17
阅读次数:
101
一、向Info中插入数据。1.从界面输入信息。2.输入内容的检查:基本格式的检查,主外键的检查。3.执行插入class Program { //定义常量 public const string CONNECTIONSTRING = "server=.;database=mydb;uid=sa;pwd...
分类:
Web程序 时间:
2015-05-07 22:00:03
阅读次数:
127
Given two integers representing the numerator and denominator of a fraction, return the fraction in string format.If the fractional part is repeating, enclose the repeating part in parentheses.For exam...
分类:
其他好文 时间:
2015-05-07 20:32:14
阅读次数:
162
埃氏筛法/*用“埃氏筛法”求2~1/*00以内的素数。2~100以内的数,先去掉2的倍数,再去掉3的倍数,再去掉4的倍数,……依此类推,最后剩下的就是素数。*/package week_1;public class Sushu { public static void main(String[] a...
分类:
其他好文 时间:
2015-05-07 20:19:47
阅读次数:
609
https://leetcode.com/problems/reverse-words-in-a-string/Given an input string, reverse the string word by word.For example,Given s = "the sky is blue"...
分类:
其他好文 时间:
2015-05-07 20:19:27
阅读次数:
106
(一)实验代码和截图public class MyUtil { public static String percentage2fivegrade(int grade){ if(grade0){ System.out.println(this.sh+"+"+this.xu+"i"); }else i...
分类:
其他好文 时间:
2015-05-07 20:18:14
阅读次数:
129
Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.For "(()", the lon...
分类:
编程语言 时间:
2015-05-07 20:11:27
阅读次数:
154
java老师布置的作业,要我们编个计算器,而且要有括号功能。。。编的恶心哪,600多行代码,调试来调试去终于能用了,但是估计还有bug。
有一个bug我自己知道,但是不影响正常使用:可以存在前导零,就是说可以有0087这种数字,计算器会认为这就是87,。
下面是两个截图,左边是输入,右边是输出。
这个计算器的核心算法就是对左边的字符串进行处理,得出右边的结果,其中要考虑到括号匹配、负号、乘除优先级等等问题,这一个算法写了200行。
因为字符串比较短,最多就几十,所以我的算法比较暴力,没有考虑时间和空间复杂度...
分类:
编程语言 时间:
2015-05-07 19:01:18
阅读次数:
253
Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.For example, given
s = “leetcode”,
dict = [“leet”, “...
分类:
其他好文 时间:
2015-05-07 18:56:26
阅读次数:
114