由买买提看人间百态

topics

全部话题 - 话题: string
1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)
w*******y
发帖数: 60932
P********e
发帖数: 2610
2
来自主题: Programming版 - C++一个string的小问题
google can help on those issues:
#include
string();
string( const string& s );
string( size_type length, const char& ch );
string( const char* str );
string( const char* str, size_type length );
string( const string& str, size_type index, size_type length );
string( input_iterator start, input_iterator end );
~string();
string doesn't take any char to initialize
so, do this:
string b = "";
b.append(0,a.at(0));

不好意思,是我写问题的时候打错了
应该是
string A="God";
string B=A.at(0);
编译时
s*******e
发帖数: 93
3
来自主题: JobHunting版 - 一道有关String的面试题
因为只是词被打乱,空格被删除,没有打乱整个词组,所以我想到的做法是
(应该可以work,但是可能效率不是最高的)
bool equals(string s1, string s2);
string firstNString(string s, int count);
string substringFromIndex(string input, int index);
string sort(string);
(以上几个function应该可以意会,就不implement了)
bool beginsWith(string input, string word)
{
return equals(sort( firstNString(input,word.length) ) , sort(word) );
}
struct result
{
string str;
bool ok;
}
typedef struct result Result;
Result function(string input, string[] words)
{
found=false;... 阅读全帖
OE
发帖数: 369
4
想知道JVM内部到底是如何实现string pool的。
string pool里存的到底是string objects还是string references?
string pool和class constant pool的关系是什么样的?
public class hello1{
public static String s="Hello!"
}
public class hello2{
public static void main (String[] args){
String s = "Hello!";
System.out.println(s==hello1.s);//this is true
}
}
if you check the constant pool in .class files, you can see both classes
have "#n = Utf8 Hello!" in their constant pool. 但我猜,当JVM load这两个
classes,它们各自的runtime constant pool把"Hello1"存成... 阅读全帖
OE
发帖数: 369
5
想知道JVM内部到底是如何实现string pool的。
string pool里存的到底是string objects还是string references?
string pool和class constant pool的关系是什么样的?
public class hello1{
public static String s="Hello!"
}
public class hello2{
public static void main (String[] args){
String s = "Hello!";
System.out.println(s==hello1.s);//this is true
}
}
if you check the constant pool in .class files, you can see both classes
have "#n = Utf8 Hello!" in their constant pool. 但我猜,当JVM load这两个
classes,它们各自的runtime constant pool把"Hello1"存成... 阅读全帖
r*******y
发帖数: 1081
6
来自主题: Programming版 - string operator +
string library defines these overloaded operator +
string operator+ (const string& lhs, const string& rhs);
string operator+ (const char* lhs, const string& rhs);
string operator+ (char lhs, const string& rhs);
string operator+ (const string& lhs, const char* rhs);
string operator+ (const string& lhs, char rhs);
We know
string s = "hi" + "ji";
is not OK
If compiling this using g++ , I get the error :
invalid operands of types ‘const char [3]’ and ‘const char [3]’ to
binary ‘operator+’
I am a lit... 阅读全帖
OE
发帖数: 369
7
ldc是这样解释的:
Pushing a String causes a reference to a java.lang.String object to be
constructed and pushed onto the operand stack.
astore是这样解释的:
Pops objectref (a reference to an object or array) off the stack and stores
it in local variable
根据这篇文章http://mindprod.com/jgloss/interned.html#UNDERTHEHOOD
我是这样理解的:
那两个string ref.在ldc时就是相同的。与“Hello!”相对应的string object在class
loading的时候就生成了,而且会有一个weak string ref.(指向这个string object
)被放到一个hashmap里。这个hashmap有时就被称为string pool。当第二个class被
load
,或则说它的runtime c... 阅读全帖
OE
发帖数: 369
8
ldc是这样解释的:
Pushing a String causes a reference to a java.lang.String object to be
constructed and pushed onto the operand stack.
astore是这样解释的:
Pops objectref (a reference to an object or array) off the stack and stores
it in local variable
根据这篇文章http://mindprod.com/jgloss/interned.html#UNDERTHEHOOD
我是这样理解的:
那两个string ref.在ldc时就是相同的。与“Hello!”相对应的string object在class
loading的时候就生成了,而且会有一个weak string ref.(指向这个string object
)被放到一个hashmap里。这个hashmap有时就被称为string pool。当第二个class被
load
,或则说它的runtime c... 阅读全帖
b*******3
发帖数: 109
9
来自主题: JobHunting版 - 一道string matching的题目
贴个java solution O(n m) :
public String minWindow (String originalString, String patternString)
{
List valuePairs = new ArrayList();
int shortestWindowLength = originalString.length();
int shortestHolderIndex = 0;

for (int i=0; i< originalString.length(); i++)
{
if (patternString.indexOf(originalString.charAt(i))>=0)
{
ValuePair valuePair = new ValuePair(originalSt... 阅读全帖
h**********I
发帖数: 51
10
来自主题: JobHunting版 - 求教一个string match 的 dp 解法
private String getToken(char c, char op) {
String s = c + "" + c;
if (op == '+')
return s;
return s + s;
}
private int findMatches(String s1, String s2, int begin, HashMap Integer> cache) {
if (s2.length() == 0)
return 1;
if (begin >= s1.length() - 1)
return 0;

String cacheKey = s2 + "_" + begin;
if (cache.containsKey(cacheKey))
return cache.get(cacheKey);

... 阅读全帖
a**********0
发帖数: 422
11
来自主题: JobHunting版 - 请教一个题 string similarity
For two strings A and B, we define the similarity of the strings to be the
length of the longest prefix common to both strings. For example, the
similarity of strings "abc" and "abd" is 2, while the
similarity of strings "aaa" and "aaab" is 3.
Calculate the sum of similarities of a string S with each of it's
suffixes.
Input:
The first line contains the number of test cases T. Each of the next T lines
contains a string each.
Output:
Output T lines containing the an... 阅读全帖
m****z
发帖数: 978
12
来自主题: Tennis版 - New String Tip (enlarge sweet spots)
Come across this article at Http://www.tennisindustrymag.com/issues/201409/index.php
To me, its main idea is to create lower tension around the edge of the
racquet to enlarge the sweet spot. At the same time, keeping the center of
racquet similiar to the current power level, so it won't be to powerful at
the center. Large sweet spot and off center shot play closer to sweet spot.
And sweet spot will not be too powerful.
My machine does not have pre-streach function, so I will just pull the
ce... 阅读全帖
n******1
发帖数: 3756
13
http://docs.oracle.com/javase/specs/jls/se7/html/jls-3.html#d5e
Literal strings within the same class (§8) in the same package (§7)
represent references to the same String object (§4.3.1).
Literal strings within different classes in the same package represent
references to the same String object.
Literal strings within different classes in different packages likewise
represent references to the same String object.
Strings computed by constant expressions (§15.28) are computed at compile
time and... 阅读全帖
n******1
发帖数: 3756
14
来自主题: Java版 - 问个set和literal String的问题
为什么我这里的literal string 和我的封装类equals不上呢,放进set里面也说不相同
,但是hashcode是相等
import java.util.HashSet;
import java.util.Set;
public class SetTesting{

static class WrapString{
String str;
public WrapString(String str){
this.str = str;
}

@Override
public String toString(){
return str;
}

@Override
public int hashCode(){
return str.hashCode();
}
@Override
p... 阅读全帖
a***y
发帖数: 2803
15
来自主题: Programming版 - string operator +
string s = "hi" + "ji";
是不是left operand,right operand都是const char*,在5个函数里都没有这个
signature?
"At least one of the arguments used has to be a string object."
参考:
http://www.cplusplus.com/reference/string/operator+/
Parameters
lhs
A string object, a c-string or a character. Its content forms the
beginning of the returned object.
rhs
If lhs is a string object, this is another string object, a c-string or
a character.
If lhs is not a string object, this is a string object.
In either cas... 阅读全帖
a**u
发帖数: 99
16
来自主题: Science版 - String Theory Basics 4
What is string theory?
.gif
There are two basic types of string theories: those with closed string
loops that break into open strings, and those with closed string loops
that don't break into open strings
Think of a guitar string that has been tuned by stretching the string
under tension across the guitar. Depending on how the string is
plucked and how much tension is in the string, different musical notes
will be created by the string. These musical notes could be said to be
excitation modes of
P********l
发帖数: 452
17
How about this version using Dynamic Programming?
The basic idea is fill in a table for a matching path. If the last pair
matches, the whole string will match.
mtch is the array, which is of (string length + 1)*(pattern length + 1).
mtch[0][*] and mtch[*][0] is padded with false.
Then the function is something like:
mtch[i][j] =
1. if pattern char='.', mtch[i][j]=mtch[i-1][j-1]
2. if pattern char='*', mtch[i][j]=mtch[i-1][j-1] || mtch[i][j]=mtch[i-1][
j]
3. if pattern char=string char, mtc... 阅读全帖
B*******1
发帖数: 2454
18
来自主题: JobHunting版 - google scramble string O(n) 解法
My code
pass all the test on 1337 online judge.
bool isScrambleHelper(const string &s1, const string &s2, map string>, bool> &myMap)
{
pair key = make_pair(s1, s2);
if (myMap.count(key) != 0) return myMap[key];
bool result = false;
if (s1 == s2) {
result = true;
} else if (s1.size() != s2.size() ) {
result = false;
} else {
for (int i = 1; i < s1.size(); i++) {
if ((isScrambleHelper(s1.substr(0, i), s2.substr(... 阅读全帖
r*********n
发帖数: 4553
19
来自主题: JobHunting版 - Leetcode Scramble String简单解法
Given a string s1, we may represent it as a binary tree by partitioning it
to two non-empty substrings recursively.
Below is one possible representation of s1 = "great":
great
/
gr eat
/ /
g r e at
/
a t
To scramble the string, we may choose any non-leaf node and swap its two
children.
For example, if we choose the node "gr" and swap its two children, it
produces a scrambled string "rgeat".
rgeat
/
rg eat
/ /
r g e at
... 阅读全帖
w*******y
发帖数: 60932
20
Target.com is offering buy 1 get 1 free on most of their Philips LED string
lights with FREE SHIPPING. You do not need a promo code. Just add
multiples of 2 and you will see the discount. Some are not marked b1g1 but
are giving the discount.
This promo is for today (12/03/11) only. I could be wrong.
Here is the list for the lights:
Philips LED string lights:
http://www.target.com/c/party-supplies-holidays/-/N-5xt3c/Ntk-A led /Ntx-matchallany
I got the following (for reference):
Philips 25 L... 阅读全帖
P********l
发帖数: 452
21
Fixed the issue ihasleetcode mentioned. Thanks.
Added more test cases like:
string = "ho"
pattern = "**ho", "ho**"
string = "a", pattern = "aa"
string = "aa", pattern = "a"
Code:
/**
* check if patt matches the string str. Same as {@link match} but
* one-dimension array is used.
*
* @param str
* the string to match
* @param patt
* the pattern matching str. '*' is for 0 or more characters
and
* '.' is for exactly one cha... 阅读全帖
w*******s
发帖数: 96
22
If the string is not the same length, my code will crash because of array
index out of boundary. Can you help find the bug?
//Refer Algorithm 4th, page 722
void exch(string &a, string &b)
{
string c = a;
a = b;
b = c;
}
int compare(int a, int b)
{
if (a if (a==b) return 0;
if (a>b) return 1;
}
void ThreeWayQsort(vector &v, int low, int high, int d)
{
if (high<=low) return;
//3 way partition to handle duplicate
int lt = low;
int gt = h... 阅读全帖
g*******s
发帖数: 2963
23
要求写两个function, signature定义如下。把两个string 合并成一个,再把这个合成
的string还原成两个。string可以包含任意字母任意顺序,另外要求是不允许用额外空
间。比如合并的时候插入新字母或者返回额外变量记录长度什么的。
string serialize(string &str1, string &str2);
void deserialize(string &str, string &str1, string &str2);
c*******s
发帖数: 127
24
来自主题: Tennis版 - String Tension
I recently changed my racquet to Head IG Radical Pro. I felt the string is
very tight / stiff if I string racquet at 52 pounds with full Poly Strings
as I used to with old racquets, like Head Flexpoint radical.
Did a little bit investigation and found now most of the Head newer racquets
are marked with String Tension: 48-57 pounds instead of 52 to 62 pounds.
Any one know why Head lowed their string tension specs to their newer
racquets? Is that because of the new racquet materials?
One tennis... 阅读全帖
w***y
发帖数: 6251
25
假如已经有了一个Arraylist p, 里面的元素其实是一些string
我想转成一个String[]
String[] y = new String[p.size()];
for ( i=0;i< p.size(); i++){
y[i] = (String)p.get(i);
}
可是执行到y[i] = (String)p.get(i);总是有 java.lang.ClassCastException
怎么回事呢?
我还试了String[] predators = (String[])al.toArray( new String[ al.size() ] );
这样的, 但是error是 java.lang.ArrayStoreException:((
thx
w*******y
发帖数: 60932
26
Musicians Friend has four different sets of Hendrix Guitar strings for $2
Per Set with Free Shipping
Dean Markley 8863 Jimi Hendrix NPS Medium Electric Guitar Strings
Link:
http://accessories.musiciansfriend.com/product/Dean-Markley-8863-Jimi-Hendrix-NPS-Medium-Electric-Guitar-Strings?sku=101730
Dean Markley 8860 Jimi Hendrix NPS RR Electric Guitar Strings
Link:
http://accessories.musiciansfriend.com/product/Dean-Markley-8860-Jimi-Hendrix-NPS-RR-Electric-Guitar-Strings?sku=101727
Dean Markley 8... 阅读全帖
y*******n
发帖数: 129
27
来自主题: JobHunting版 - 一道有关String的面试题
store list of words in hashtable
key: signature
value: list of words with the same signature.
recurse on input to find solution
code:
typedef std::map > Dict;
typedef std::map >::iterator DictIter;
void descramble(const std::string& input, std::string& output, Dict& dict) {
if (input.empty()) {
std::cout << output << std::endl;
} else {
for (size_t i=1; i<=input.size(); i++) {
std::string ... 阅读全帖
S**I
发帖数: 15689
28
来自主题: JobHunting版 - 请教c++的string vector问题,谢谢!
error message说的很清楚:string类的operator<没有定义,改成这样子就行了:
#include
#include
#include
#include
#include
using namespace std;
bool comp(const string& s1, const string& s2){
return strcmp(s1.c_str(), s2.c_str()) < 0;
}
int main () {
char *m1[] = {"a","e","c","m"};
vector v1(m1,m1+4);
char *m2[] ={"n"};
vector v2(m2,m2+1);
vector u;
/* int m1[] = {1,2,3,4};
vector v1(m1,m1+4);
int m2[] ={... 阅读全帖
L**********u
发帖数: 194
29
来自主题: JobHunting版 - Exposed上一道string permutation的题
I solved this problem several days ago. hehe
My algorithm is following:
//print out all permutations of a given string.
//A string with n characters has n! permutations
//The permutations can be obtained by the following method.
//n=1, only one permutation 1
//n=2, permutations are obtained by inserting 2 to every possible positions
of each string obtained when n=1
// there are two possible positions and one string, therefore
permutations are
// 21 12
//n=3, permutations are o... 阅读全帖
a*******y
发帖数: 1040
30
/*
You are given a String number containing the digits of a
phone number (the number of digits, n, can be any positive integer) . To
help you memorize
the number, you want to divide it into groups of contiguous digits. Each
group must contain
exactly 2 or 3 digits. There are three kinds of groups:
• Excellent: A group that contains only the same digits. For example,
000 or 77.
• Good: A group of 3 digits, 2 of which are the same. For example, 030
, 229 or 166.
• Usual: A group ... 阅读全帖
f***c
发帖数: 338
31
来自主题: JobHunting版 - reverse words in a string
op的帖子没有别的其它说明.
还有标点符号,或者连续多于一个的空格的情况[俺的code对这个情况没有处理,简单
试了一个,seg错误],俺的解法只对 “正常” 的输入有效。
这里的s要不要处理内存(in main)?
请专家指正。谢谢!
=============================================
给定 s = "Hello World"
要求这样 ==> "dlroW olleH"
直接swap s[i] 和 s[n-i-1] 只要 i < n - i - (2*i+1 < n)
这个简单,甚至都不要界定word,space也跟着swap了
不过题目既然叫word in string,应该这不是要的解
否则直接call下面的函数就可以了,reverseCall(s,0,s.size)
还是这样 ==> "olleH dlroW"
using namespace std;
void reverseWord(string &s, size_t start, size_t end) {
size_t i = 0;
... 阅读全帖
a***e
发帖数: 413
32
我感觉word ladder 2的思路比这道题还容易点,算法还比较出名,就是很不好写。。
。。。。。。
yuxrose (鱼香肉丝), 我倒是找到两个比较简洁的答案,但是最烦recursion。。。。
。。我觉得自己都缺乏动力搞懂这个题,也可能今天状态不佳。看答案都不清楚为啥,
都想放弃刷题啦!
但是花时间仔细琢磨,第一个答案好像也不是那么那么难,但第二个就不知道在干嘛了
,搞了3d table。晕啊!哪位大牛能解释一下呢?
如果没见过,谁能15分钟内搞懂题意,到写完代码,估计得下了狠功夫的。
这个有recursion还比没有recursion的快!
class Solution {
private:
bool isDeformation(string &s1, string &s2)
{
if(s1.size() != s2.size())return false;
int albe[26] = {0};
for(int i = 0; i < s1.size(); i ++)
albe[s1[i]... 阅读全帖
h**********I
发帖数: 51
33
来自主题: JobHunting版 - 求教一个string match 的 dp 解法
这是我的DP解法,测试过的:
private String getToken(char c, char op) {
String s = c + "" + c;
if (op == '+')
return s;
return s + s;
}
private boolean match(String s1, int s1EndIndex, String token) {
for (int i = token.length() - 1; i >= 0; i--, s1EndIndex--) {
if (s1EndIndex < 0)
return false;

if (s1.charAt(s1EndIndex) != token.charAt(i))
return false;
}
return true;
}

public int findMatches(String s1, String s2) {
int s1Len = s1.lengt... 阅读全帖
b*****t
发帖数: 758
34
来自主题: Tennis版 - racquet size and string duration
I used to play oversized racquet (110), stringing with the most durable
strings (prince problend duraflex) at 62 lbs. The strings very consistently
lasted for 8-10 matches.
I now play 100 racquet, stringing at 58lbs (to get the similar feeling as
62lbs on the 110 racquets). The first two Babolat XCel strings (not durable
strings) both broke at their 8th matches. The current string, a Babolat
hurricane tour, already lasts for 16 matches. I still do not see any wear-
off on the string, but the sou
a***r
发帖数: 420
35
来自主题: Computation版 - [C++]string array?
我有一个n*m的dataset,里面的信息是两个没有顺序的字母,ie.A B,B C,C B...
因为dataset很大,打算用C++处理,有个基础问题,网上教程老看不明白,
就是如何建立一个string的array?
比如在把这些信息存入C++的array时,我现在是建了一个三维的char数组,可否/如何
直接建立一个
string的二维数组呢?
如果上面这个问题成立,即如果可以有string的数组
有什么好办法可以把一个string分成指定大小,存入指定长度的string的数组呢?
比如我为了sql方便,把每行的m个col合成一个field
相当于成了一维的string数组
然后我在mysql里面sort啥的完了
用getline(cin,line),重新读入c++的二维数组,这时我希望把这个field按两个两
个放到
string的array里,但是getline似乎没有相应的命令,或者,我应该在合成field的时
候,就在每
两个字母间加个delimiter,然后用getline(cin,line,delim)?
另外,从generally的来说,string,是不是可以完全... 阅读全帖
c**********e
发帖数: 2007
36
【 以下文字转载自 Programming 讨论区 】
发信人: careerchange (Stupid), 信区: Programming
标 题: How to convert string to string array (or vector)
发信站: BBS 未名空间站 (Mon Sep 13 19:18:21 2010, 美东)
It looks that`in Java, there is a function Split which convert a string to a
string array. I wonder if we could do the same in C++. How to do the
conversion?
string MyString = "value1;value2;value3;value4;"
string[] MyStringArray = MyString.Split(';');
MyStringArray[0] (would give value1)
MyStringArray[1] (would give value2)
P********l
发帖数: 452
37
Same as previous version but only 1-dimension array is used.
time complexity is still O(mn).
You can check the code here:
http://code.google.com/p/sureinterview/source/browse/src/solution/string/WildcardMatching.java
After you logged in, you can conveniently put comments on the code.
/**
* check if patt matches the string str. Same as {@link match} but
* one-dimension array is used.
*
* @param str
* the string to match
* @param patt
* ... 阅读全帖
g**********y
发帖数: 14569
38
来自主题: JobHunting版 - Exposed上一道string permutation的题
没仔细看后面回帖,贴一个Java解,就是实现next_permute()。对任意输入串,把字母
排序,然后调用就行。
这里的main()就是给了个简单例子。

public class NextPermute {
/**
* Return next permute number/string in sequence. If already highest,
* return null.
*
* @param number
* @return
*/
public String nextPermute(String s) {
int N = s.length();
StringBuilder sb = new StringBuilder(s);

int head = N - 2;
while (head >= 0 && sb.charAt(head) >= sb.charAt(head+1)) head--;
if (h... 阅读全帖
w**5
发帖数: 34
39
可以这样不?
string serialize(string &str1, string &str2)
{
string str = str1;
str.append(str2);
str[str1.length()] |= 0x80; // 把st2的第一个char变成负数
return
}
void deserialize(string &str, string &str1, string &str2)
{
for (int i=0; i {
if (str[i] < 0) {
str[i] &= 0x7f;
str1 = str.substr(0, i);
str2 = str.substr(i, str.length() - i);
}
}
}
n******9
发帖数: 22
40
RT. 谁能给出具体代码实现。
输入为stream of string,字符串数据流,找出在过去30分钟之内输入string里面出现
次数最多的前10个string?
哪位大神能够给出具体代码实现 或者 解决此类问题的方法总结的网址链接?
(对于此题,如果我们已经找出了30分钟内所有的输入的string,也建立了hashtable
去记录了每种string的出现次数,如何能快速或者最简单的找到前10个string?我想用
priorityqueue来找出前10个,谁能指教一下。)
g****s
发帖数: 1755
41
来自主题: JobHunting版 - Reverse Words in a String
Just saw this questiong #151 one LeetCode :)
I used a stack and string.split() method.
private static String reverseWords(String s) {
if(s.length() == 0) return s;
String[] split = s.split(" ");

int Len = split.length;
if(Len == 0) return "";
Stack stc = new Stack();
for(int i=0; i if(!split[i].equals("")
stc.push(split[i]);
}
String retStr = stc.pop();
while(!st... 阅读全帖
g****s
发帖数: 1755
42
来自主题: JobHunting版 - Reverse Words in a String
Just saw this questiong #151 one LeetCode :)
I used a stack and string.split() method.
private static String reverseWords(String s) {
if(s.length() == 0) return s;
String[] split = s.split(" ");

int Len = split.length;
if(Len == 0) return "";
Stack stc = new Stack();
for(int i=0; i if(!split[i].equals("")
stc.push(split[i]);
}
String retStr = stc.pop();
while(!st... 阅读全帖

发帖数: 1
43
来自主题: JobHunting版 - 求教一个string match 的 dp 解法
题目如下:
String s1 = "
waeginsapnaabangpisebbasepgnccccapisdnfngaabndlrjngeuiogbbegbuoecccc";
String s2 = "a+b+c-";
s2的形式是一个字母加上一个符号,正号代表有两个前面的字符,负号代表有四个,也
就是说s2其实是"aabbcccc",不考虑invalid。
在s1中,找出连续或者不连续的s2,也就是说从s1中找出"aa....bb.....cccc",abc顺
序不能变,但是之间可以有零个或多个字符,返回共有多少个。在上面这个例子中,有
四个。
----------------------------------------------------------------------
这里有解答,但是测试后发现不对(http://www.1point3acres.com/bbs/thread-145290-1-1.html
结果测试sln.findMatches("aaaaaa", "a+a-") ,出来结果为0,不对
另外System.out.println(sln.fin... 阅读全帖
b*****t
发帖数: 758
44
This is my reference point. I want something that has similar topspin feel,
but easier for the arm.
I have been playing with pro hurricane tour on APD for about 1.5 year. The
topspins are great and each string lasts for about six months before the
tension drops too much. But my upper arm feels a little uncomfortable lately
. I believed my days with the lovely pro hurricane tour were over, and
ordered a stringing machine.
Last week, I changed from pro hurrican tour to Xcel, an arm friendly string... 阅读全帖
b*********s
发帖数: 6757
45
来自主题: Tennis版 - 问 string tension 问题
cool thanks, that's what I found in my search too.
What is interesting is when I string a racquet at 54/54, after the stringing
, it measures to be at 60/48. It is said the string meter is measuring the
force that needed to deflect a string.... going back to the original
question. If someone told me to use 46lb, should I just string it at 46, the
result from the string meter will be 50/42, or should I string 48/44, which
results in something like 52/40?
Probably, just have to experiment and try ... 阅读全帖
b*e
发帖数: 3845
46
来自主题: Tennis版 - Poly Star Energy String Reel Deal
http://www.amazon.com/Poly-Star-Energy-Tennis-String/dp/B003YOW
Having tried this string for the last couple months, I really like the power
and softness from Poly star Energy, especially 17g gauge. Decided to buy a
reel of this string. Here is the deal on Amazon. The listed price on
TennisExpress or Midwest is $87/reel. This one (I already received one reel,
it's European packaging) only cost around $53 shipped. It's about $3 a set.
Note that this string is very powerful. So I only recommend if... 阅读全帖
l******0
发帖数: 244
47
如果一个词典 Dictionary 包含英文中的单词,将一个 String 分割为合法的单词。假
设 Dictionary 存在一个 HashSet 中。
String str = "Iloveyou"
分割为 "I love you".
String segment(String str, HashSet dictionary){
String segmented="";

// Iloveyou
int size = str.length()+1;
int j = 0;
int i;
for(i=1; i String subStr = str.substring(j,i);
if(dictionary.contains(subStr)){
segmented += subS... 阅读全帖
b**n
发帖数: 289
48
来自主题: Programming版 - Question about
Right, Thanks a lot.
The following code is OK:
#include
using std::string;
int main(){
string str = "string";
return 0;
}
The following one is NOT OK:
using std::string;
int main(){
string str = "string";
return 0;
}
I guess header file somehow already included . I am not
sure about this.
Thanks a lot.
x****t
发帖数: 389
49
来自主题: Programming版 - C++一个string的小问题
不好意思,是我写问题的时候打错了
应该是
string A="God";
string B=A.at(0);
编译时候说:
string.cc: In function ‘int main()’:
string.cc:9: error: invalid conversion from ‘char’ to ‘const char*’
string.cc:9: error: initializing argument 1 of ‘std::basic_string<_CharT,
_Traits, _Alloc>::basic_string(const _CharT*, const _Alloc&) [with _CharT =
char, _Traits = std::char_traits, _Alloc = std::allocator]’
是不是string B也要const的才行?但是如果要读不同的string的第一个字母呢?
多谢!
y****d
发帖数: 291
50
来自主题: Computation版 - [C++]string array?
1. #include
#include
using namespace std;
const num=100;
string ct[num][num];
这个你要知道每个维度有多大。
2. 你是想把二维变成一维的话,用string temp=ct[0][0].append(ct[0][index]), 最
后就是你想要的那一行的合成吧。
3. 不全是吧。C里面的string最后一个是\
null,c++里面是string class的一个对象。如果想从c++转c的string,
#include
temp.cstr()是做这个的。如果要把char *变成c++ string,#include
sstream ss; ss>>temp;a=temp.str()就好了。
我觉得还是python好用,用python没那么麻烦
1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)