会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
仔细思考一切
!!!
首页
管理
上一页
1
···
5
6
7
8
9
10
11
12
13
···
15
下一页
2016年1月7日
18.1---不用加号的加法(CC150)
摘要: 1,自己写的又长又臭的代码,也能AC,但是太丑了。主要是通过二进制来算。public static int addAB(int a, int b){ int res = 0; String str1 = Integer.toBinaryString(a); ...
阅读全文
posted @ 2016-01-07 12:31 仔细思考一切
阅读(269)
评论(0)
推荐(0)
2016年1月6日
18.4---2出现了几次(CC150)
摘要: 思路:1,先给出LTE的代码: public static int countNumberOf2s(int n) { // write code here int res = 0; for(int i = 0; i 0){ i...
阅读全文
posted @ 2016-01-06 10:40 仔细思考一切
阅读(207)
评论(0)
推荐(0)
2016年1月5日
17.5---珠玑妙算,四个槽,红色黄色绿色蓝色(CC150)
摘要: 思路:注意一下,找猜中的时候什么都不用做,直接统计,找伪猜中也是先不管,然后再把结果减去猜中即可。public static int[] calcResult(String a, String b){ int[] res = new int[2]; Str...
阅读全文
posted @ 2016-01-05 17:54 仔细思考一切
阅读(402)
评论(0)
推荐(0)
17.2---#字棋(CC150)
摘要: 牛客网的在线题。思路,比较简单。就是判断一下是否有连起来的1. public static boolean checkWon(int[][] board){ boolean res = false; for(int i = 0; i < 3;i++){ ...
阅读全文
posted @ 2016-01-05 16:59 仔细思考一切
阅读(159)
评论(0)
推荐(0)
17.3---阶乘尾多少个0(CC150)
摘要: 思路,其实这题easy,就是看多少个5.答案: public static int getFactorSuffixZero(int n) { // write code here int res = 0; while(n != 0){ ...
阅读全文
posted @ 2016-01-05 14:46 仔细思考一切
阅读(210)
评论(0)
推荐(0)
17.4---返回max,不用if
摘要: 思路:借助max公式就可以了。max(x,y)=0.5*(x+y+|x-y|)注意:1,结尾要加(int)。答案:max(x,y)=0.5*(x+y+|x-y|)View Code
阅读全文
posted @ 2016-01-05 13:08 仔细思考一切
阅读(170)
评论(0)
推荐(0)
11.8---维护x的秩(CC150)
摘要: 思路:比较easy。就是借助hashset让他有序然后就能够比较节省时间了。答案: public static int[] getRankOfNumber(int[] a, int n){ int[] res = new int[n]; HashSet ha...
阅读全文
posted @ 2016-01-05 11:46 仔细思考一切
阅读(169)
评论(0)
推荐(0)
2016年1月4日
11.7---叠罗汉表演节目(CC150)
摘要: 1,牛客网第一题:这其实跟找最长递增子序列是一个东西。注意的地方是,返回的是最大的dp,而不是dp[N-1]。答案:public static int getHeight(int[] men, int n) { // write code here int res = 0...
阅读全文
posted @ 2016-01-04 23:54 仔细思考一切
阅读(278)
评论(0)
推荐(0)
11.6---矩阵查找元素(CC150)
摘要: 思路,一旦提到查找就要想到二分查找。 public static int[] findElement(int[][] a, int n, int m, int key) { // write code here int[] res = new int[2]; ...
阅读全文
posted @ 2016-01-04 23:42 仔细思考一切
阅读(182)
评论(0)
推荐(0)
11.5---含有空字符串的字符串查找(CC150)
摘要: 注意,1,"" 和 " "。是不同的,空字符串指的是"";2,注意String的compareTo。小于是指 left && a[mid] == "") { mid--; } if(key.equals...
阅读全文
posted @ 2016-01-04 23:18 仔细思考一切
阅读(349)
评论(0)
推荐(0)
上一页
1
···
5
6
7
8
9
10
11
12
13
···
15
下一页