有谁编程题全AC了的,麻烦留个名(顺便留下代码)

有谁编程题全AC了的,麻烦留个名(顺便留下代码)#京东##Java工程师#
全部评论
第一题AC了,第二题不会做 import java.util.*; public class NO1 { public static void main(String[] args) { Scanner in = new Scanner(System.in); String s = in.nextLine(); Map<String,Integer> map = new HashMap<>(); map.put("()", 1); int result = helper(s,map); System.out.println(result); } public static int helper(String s , Map<String,Integer> map){ if(map.containsKey(s)){ return map.get(s); } int count = 0; int result = 0; for(int i = 0 ; i < s.length(); i ++){ if(s.charAt(i) == '('){ count++; }else{ count--; } if(count >= 0 && s.charAt(i) == ')'){ String left = s.substring(1,i); String right = s.substring(i+1,s.length()); result+= helper(left+right,map); } } map.put(s,result); return result; } }
点赞 回复 分享
发布于 2017-09-08 21:13
神奇数字 55555 js版本 为毛只有20%?
点赞 回复 分享
发布于 2017-09-08 21:15
第一题最后30秒做出来了,提交没时间。。。
点赞 回复 分享
发布于 2017-09-08 21:15
#第一题 import math n = input() n=int(n) x=(-1+(1+8*n)**0.5)/2 print(math.ceil(x))#向上取整
点赞 回复 分享
发布于 2017-09-08 21:16
# 第一题 AC import math x = int(input()) a = math.sqrt(2*x+1/4)-0.5 a = math.ceil(a) print(a) #第二题 20% print(n*n+n*(n-1)) 猝
点赞 回复 分享
发布于 2017-09-08 21:27

相关推荐

02-12 00:59
已编辑
哈尔滨工业大学 产品经理
华为 软件开发岗 20.6*16薪 本科
点赞 评论 收藏
分享
肥沃富饶:可能初创公司,老板不懂技术
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务