Redian新闻
>
当你想吃垃圾食品的时候,就看看这张照片。
avatar
当你想吃垃圾食品的时候,就看看这张照片。# Joke - 肚皮舞运动
d*w
1
告诉元音字母map到数字 (a=1, e=5, i=9, o=15, u=21, y=25),y特殊些,当 前面的
字母是不是元音才计算值。如果是连续的元音使用乘法,否则把几段值相加。
给字符串计算它代表的值,
Example:
"Queue" = 21 * 5 * 21 * 5 = 11025.
"myopia" = 25 * 15 + 9 * 1 = 384.
“I'm Feeling Yucky” split into "I", "ee", "i", "u", and "y" ,first 'Y' is
preceded by a space,
the value is 9 + 5 * 5 + 9 + 21 + 25 = 89.
"gayyou" has a score of 1 + 25 * 15 * 21 = 7876, since the first y makes
the second y a vowel.
avatar
P*y
2
LG是主申请人。我的面试在前,他的面试比我晚几天。
我面试的时候,肯定需要他跟我一起去,但是需要他带他的面试通知原件么?
他去面试的时候,就不需要我跟着一起了吧?
多谢
avatar
c*7
3
=.=
avatar
m*l
4
好踢

is

【在 d********w 的大作中提到】
: 告诉元音字母map到数字 (a=1, e=5, i=9, o=15, u=21, y=25),y特殊些,当 前面的
: 字母是不是元音才计算值。如果是连续的元音使用乘法,否则把几段值相加。
: 给字符串计算它代表的值,
: Example:
: "Queue" = 21 * 5 * 21 * 5 = 11025.
: "myopia" = 25 * 15 + 9 * 1 = 384.
: “I'm Feeling Yucky” split into "I", "ee", "i", "u", and "y" ,first 'Y' is
: preceded by a space,
: the value is 9 + 5 * 5 + 9 + 21 + 25 = 89.
: "gayyou" has a score of 1 + 25 * 15 * 21 = 7876, since the first y makes

avatar
j*b
5
帮顶一下吧,我可能也会面临同样的问题。
avatar
e*t
6
吃垃圾食品还能长高,功大于过。

【在 c*******7 的大作中提到】
: =.=
avatar
d*w
7
需要逻辑缜密阿,
我实现的好像有bug,大家能想到比较好的办法么
static int encode(String str) {
int num = 0;
int sum = 0;
int cur = 0;
boolean vowelBefore = false;
boolean vowel;
str = str.toLowerCase();
for ( int i=0; i< str.length(); i++) {
if (map.get(str.charAt(i)) != null) {
cur = map.get(str.charAt(i));
vowel = true;
} else {
vowel = false;
}

if (str.charAt(i) == 'y') {
if (vowelBefore) {
vowelBefore = false;
sum += num;
num = 0;
continue;
}
}

if (vowel || (!vowelBefore && str.charAt(i) == 'y')) {
if (num == 0)
num = 1;
num *= cur;
} else if (vowelBefore && !vowel) {
sum += num;
num = 0;
}
vowelBefore = vowel;
}
return sum + num;
}

is

【在 d********w 的大作中提到】
: 告诉元音字母map到数字 (a=1, e=5, i=9, o=15, u=21, y=25),y特殊些,当 前面的
: 字母是不是元音才计算值。如果是连续的元音使用乘法,否则把几段值相加。
: 给字符串计算它代表的值,
: Example:
: "Queue" = 21 * 5 * 21 * 5 = 11025.
: "myopia" = 25 * 15 + 9 * 1 = 384.
: “I'm Feeling Yucky” split into "I", "ee", "i", "u", and "y" ,first 'Y' is
: preceded by a space,
: the value is 9 + 5 * 5 + 9 + 21 + 25 = 89.
: "gayyou" has a score of 1 + 25 * 15 * 21 = 7876, since the first y makes

avatar
s*e
8
bless,
没有经验,不过我们也可能碰到这个问题

【在 P*****y 的大作中提到】
: LG是主申请人。我的面试在前,他的面试比我晚几天。
: 我面试的时候,肯定需要他跟我一起去,但是需要他带他的面试通知原件么?
: 他去面试的时候,就不需要我跟着一起了吧?
: 多谢

avatar
r*e
9
不错

【在 c*******7 的大作中提到】
: =.=
avatar
q*x
10
烂题一道。

is

【在 d********w 的大作中提到】
: 告诉元音字母map到数字 (a=1, e=5, i=9, o=15, u=21, y=25),y特殊些,当 前面的
: 字母是不是元音才计算值。如果是连续的元音使用乘法,否则把几段值相加。
: 给字符串计算它代表的值,
: Example:
: "Queue" = 21 * 5 * 21 * 5 = 11025.
: "myopia" = 25 * 15 + 9 * 1 = 384.
: “I'm Feeling Yucky” split into "I", "ee", "i", "u", and "y" ,first 'Y' is
: preceded by a space,
: the value is 9 + 5 * 5 + 9 + 21 + 25 = 89.
: "gayyou" has a score of 1 + 25 * 15 * 21 = 7876, since the first y makes

avatar
p*h
11
bless!
avatar
p*2
12
using System;
using System.Text;
using System.Collections.Generic;
public class Calculate
{
private Dictionary ht =new Dictionary();
public Calculate()
{
ht.Add('a', 1);
ht.Add('e', 5);
ht.Add('i', 9);
ht.Add('o', 15);
ht.Add('u', 21);
ht.Add('y', 25);
}
public int Calcu(string input,int start)
{
input=input.ToLower();
int i = start;
while (i < input.Length)
if (!ht.ContainsKey(input[i]))
i++;
else
break;
if (i == input.Length)
return 0;
else
{
int result = 0;
int j = i;
while (j < input.Length)
{
if (ht.ContainsKey(input[j]))
{
if (j < input.Length-1 && input[j]=='y' && input[j + 1]
== 'y')
break;
if (j != 0 && input[j] == 'y' && input[j - 1] == ' ')
break;
if (result == 0)
result = ht[input[j]];
else
result *= ht[input[j]];
j++;
}
else
break;
}
if (j < input.Length)
return result + Calcu(input,j+1);
else
return result;
}
}
}
avatar
w*d
13
异地夫妻,难道主申请人也需要面试??
avatar
p*2
14

不是什么面试的好题。不需要什么技巧,就是对规则的实现。

【在 q****x 的大作中提到】
: 烂题一道。
:
: is

avatar
P*y
15
对。我跟LG分别接到自己的面试通知。
avatar
b*c
16
这种题纯粹考编程
写一个bool IsVowel(char c, bool isPrevVowel)
Loop through the string, using one flag to indicate if the previous one is
vowel or not, if it is, do mult, else reset current value

is

【在 d********w 的大作中提到】
: 告诉元音字母map到数字 (a=1, e=5, i=9, o=15, u=21, y=25),y特殊些,当 前面的
: 字母是不是元音才计算值。如果是连续的元音使用乘法,否则把几段值相加。
: 给字符串计算它代表的值,
: Example:
: "Queue" = 21 * 5 * 21 * 5 = 11025.
: "myopia" = 25 * 15 + 9 * 1 = 384.
: “I'm Feeling Yucky” split into "I", "ee", "i", "u", and "y" ,first 'Y' is
: preceded by a space,
: the value is 9 + 5 * 5 + 9 + 21 + 25 = 89.
: "gayyou" has a score of 1 + 25 * 15 * 21 = 7876, since the first y makes

avatar
H*e
17
这种絮絮叨叨的题最烦人le

is

【在 d********w 的大作中提到】
: 告诉元音字母map到数字 (a=1, e=5, i=9, o=15, u=21, y=25),y特殊些,当 前面的
: 字母是不是元音才计算值。如果是连续的元音使用乘法,否则把几段值相加。
: 给字符串计算它代表的值,
: Example:
: "Queue" = 21 * 5 * 21 * 5 = 11025.
: "myopia" = 25 * 15 + 9 * 1 = 384.
: “I'm Feeling Yucky” split into "I", "ee", "i", "u", and "y" ,first 'Y' is
: preceded by a space,
: the value is 9 + 5 * 5 + 9 + 21 + 25 = 89.
: "gayyou" has a score of 1 + 25 * 15 * 21 = 7876, since the first y makes

avatar
z*c
18
用一个deque存元音,每次碰到辅音或字符串结束清元音队列计算值。元音队列为空时
才把Y加入队列。
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。