diff --git a/README.md b/README.md index 1219c20..1c420b0 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,13 @@ # nuc_JavaLab -**某著名高校的某强大实验室** -# 安排 -以后每周会在GitHub发布两道题,大家pull下来然后做完提交。每周末会统计交题情况 (做完题或者不会做 自己网上找题解 先理解题意,再用代码实现,复制代码没有意义)。编程语言C/C++/JAVA均可 -。 -此活动非强制性,如果不愿意做题的请主动退出,不要给负责的同学添加工作量。:) +[![star this repo](http://github-svg-buttons.herokuapp.com/star.svg?user=youngxhui&repo=nuc_JavaLab&style=flat&background=1081C1)](http://github.com/youngxhui/nuc_JavaLab) [![fork this repo](http://github-svg-buttons.herokuapp.com/fork.svg?user=youngxhui&repo=nuc_JavaLab&style=flat&background=1081C1)](http://github.com/youngxhui/nuc_JavaLab/fork) + +某著名高校的某强大实验室 + +# 新的试题 + +这周([第二十四周作业](https://github.com/youngxhui/nuc_JavaLab/tree/master/%E7%AC%AC%E4%BA%8C%E5%8D%81%E5%9B%9B%E5%91%A8%E4%BD%9C%E4%B8%9A))开始的作业,每周一道试题。希望大家好好的做。 + # 注意 -* 建立自己的分支,按自己的姓名命名: - 如 张三 -* **请不要在master上进行提交答案** + +不要把作业提交到 `master` 分支,否则会被删除。 diff --git "a/\347\254\254\344\270\200\345\221\250\344\275\234\344\270\232/DeleteLink/ListNode.java" "b/\347\254\254\344\270\200\345\221\250\344\275\234\344\270\232/DeleteLink/ListNode.java" new file mode 100644 index 0000000..0ca5837 --- /dev/null +++ "b/\347\254\254\344\270\200\345\221\250\344\275\234\344\270\232/DeleteLink/ListNode.java" @@ -0,0 +1,16 @@ +package DeleteLink; + +/** + * Created by 晓辉 on 2016/5/22. + * Definition for singly-linked list. + * public class ListNode { + * int val; + * ListNode next; + * ListNode(int x) { val = x; } + * } + */ + public class ListNode { + int val; + ListNode next; + ListNode(int x) { val = x; } + } \ No newline at end of file diff --git "a/\347\254\254\344\270\200\345\221\250\344\275\234\344\270\232/DeleteLink/Solution.java" "b/\347\254\254\344\270\200\345\221\250\344\275\234\344\270\232/DeleteLink/Solution.java" new file mode 100644 index 0000000..279103c --- /dev/null +++ "b/\347\254\254\344\270\200\345\221\250\344\275\234\344\270\232/DeleteLink/Solution.java" @@ -0,0 +1,35 @@ +package DeleteLink; + +import DeleteLink.ListNode; + +/** + * Definition for singly-linked list. + * public class ListNode { + * int val; + * ListNode next; + * ListNode(int x) { val = x; } + * } + */ +public class Solution { + /** + * @param head a ListNode + * @param val an integer + * @return a ListNode + */ + public ListNode removeElements(ListNode head, int val) { + // Write your code here + if(head==null) return head; + ListNode p=head,q=head.next; + while(q!=null){ + if(q.val==val){ + p.next=q.next; + q=q.next; + }else { + p=p.next; + q=q.next; + } + } + if(head.val==val) head=head.next; + return head; + } +} \ No newline at end of file diff --git "a/\347\254\254\344\270\200\345\221\250\344\275\234\344\270\232/fibonacci/Solution.java" "b/\347\254\254\344\270\200\345\221\250\344\275\234\344\270\232/fibonacci/Solution.java" new file mode 100644 index 0000000..1277415 --- /dev/null +++ "b/\347\254\254\344\270\200\345\221\250\344\275\234\344\270\232/fibonacci/Solution.java" @@ -0,0 +1,31 @@ +package fibonacci; + +import java.util.Scanner; + +/** + * Created by 晓辉 on 2016/5/21. + */ +class Solution { + /** + * @return an integer f(n) + */ + + public static void main(String[] args){ + int n; + Scanner sc=new Scanner(System.in); + n=sc.nextInt(); + System.out.println(fibonacci(n)); + } + + + + public static int fibonacci(int n) { + // write your code here + if(n<2){ + return n-1; + }else{ + return Math.abs(fibonacci(n-1)+fibonacci(n-2)); +// 不要问我为什么要加绝对值…………因为他算出来是负数 + } + } +} \ No newline at end of file diff --git "a/\347\254\254\344\270\203\345\221\250\344\275\234\344\270\232/Exchange.md" "b/\347\254\254\344\270\203\345\221\250\344\275\234\344\270\232/Exchange.md" new file mode 100644 index 0000000..df9e6c0 --- /dev/null +++ "b/\347\254\254\344\270\203\345\221\250\344\275\234\344\270\232/Exchange.md" @@ -0,0 +1,25 @@ +# 题目描述 + +请编写一个函数,函数内不使用任何临时变量,直接交换两个数的值。 +给定一个int数组AB,其第零个元素和第一个元素为待交换的值,请返回交换后的数组。 +*** + +> 测试样例: + +>[1,2] + +>返回: + +>[2,1] + +```java +import java.util.*; + +public class Exchange { + public int[] exchangeAB(int[] AB) { + // write code here + } +} +``` +*** +[在线测试](http://www.nowcoder.com/practice/845ec89145b04b2b855d020d9c3ea2ef?tpId=8&tqId=11054&rp=1&ru=/ta/cracking-the-coding-interview&qru=/ta/cracking-the-coding-interview/question-ranking) diff --git "a/\347\254\254\344\270\203\345\221\250\344\275\234\344\270\232/Transform .md" "b/\347\254\254\344\270\203\345\221\250\344\275\234\344\270\232/Transform .md" new file mode 100644 index 0000000..350aec6 --- /dev/null +++ "b/\347\254\254\344\270\203\345\221\250\344\275\234\344\270\232/Transform .md" @@ -0,0 +1,23 @@ +# 题目描述 + +编写一个函数,确定需要改变几个位,才能将整数A转变成整数B。 +给定两个整数int A,int B。请返回需要改变的数位个数。 +*** +>测试样例: + +>10,5 +> +返回: + +>4 + +```java +import java.util.*; + +public class Transform { + public int calcCost(int A, int B) { + // write code here + } +} +``` +[在线测试](http://www.nowcoder.com/practice/c7df20a5a39e4357aecc1071e7fd523c?tpId=8&tqId=11022&rp=1&ru=/ta/cracking-the-coding-interview&qru=/ta/cracking-the-coding-interview/question-ranking) \ No newline at end of file diff --git "a/\347\254\254\344\270\211\345\221\250\344\275\234\344\270\232/\345\217\246\347\261\273\345\212\240\346\263\225.md" "b/\347\254\254\344\270\211\345\221\250\344\275\234\344\270\232/\345\217\246\347\261\273\345\212\240\346\263\225.md" new file mode 100644 index 0000000..8d3a601 --- /dev/null +++ "b/\347\254\254\344\270\211\345\221\250\344\275\234\344\270\232/\345\217\246\347\261\273\345\212\240\346\263\225.md" @@ -0,0 +1,24 @@ +# 题目描述 +*** +**请编写一个函数,将两个数字相加。不得使用+或其他算数运算符。 +给定两个int A和B。请返回A+B的值** +*** +*测试样例:* + +>输入:1,2 +*** +>返回:3 +*** + +```java +import java.util.*; + +public class UnusualAdd { + public int addAB(int A, int B) { + // write code here + + } +} +``` +*** +**[在线测试地址](http://www.nowcoder.com/practice/e7e0d226f1e84ba7ab8b28efc6e1aebc?tpId=8&tqId=11065&rp=1&ru=/ta/cracking-the-coding-interview&qru=/ta/cracking-the-coding-interview/question-ranking)** diff --git "a/\347\254\254\344\270\211\345\221\250\344\275\234\344\270\232/\350\257\215\351\242\221\347\273\237\350\256\241.md" "b/\347\254\254\344\270\211\345\221\250\344\275\234\344\270\232/\350\257\215\351\242\221\347\273\237\350\256\241.md" new file mode 100644 index 0000000..a3b810a --- /dev/null +++ "b/\347\254\254\344\270\211\345\221\250\344\275\234\344\270\232/\350\257\215\351\242\221\347\273\237\350\256\241.md" @@ -0,0 +1,6 @@ +# 题目描述 +*** +请设计一个高效的方法,找出任意指定单词在一篇文章中的出现频数。 +给定一个string数组article和数组大小n及一个待统计单词word,请返回该单词在文章中的出现频数。保证文章的词数小于等于1000。 +*** +**[在线测试地址](http://www.nowcoder.com/practice/ebff2814640a48fdb0d9690677f7c7de?tpId=8&tqId=11062&rp=1&ru=/ta/cracking-the-coding-interview&qru=/ta/cracking-the-coding-interview/question-ranking)** \ No newline at end of file diff --git "a/\347\254\254\344\271\235\345\221\250\344\275\234\344\270\232/\345\210\244\346\226\255\347\233\264\347\272\277\347\233\270\344\272\244.md" "b/\347\254\254\344\271\235\345\221\250\344\275\234\344\270\232/\345\210\244\346\226\255\347\233\264\347\272\277\347\233\270\344\272\244.md" new file mode 100644 index 0000000..c513834 --- /dev/null +++ "b/\347\254\254\344\271\235\345\221\250\344\275\234\344\270\232/\345\210\244\346\226\255\347\233\264\347\272\277\347\233\270\344\272\244.md" @@ -0,0 +1,21 @@ +# 题目描述 + +给定直角坐标系上的两条直线,确定这两条直线会不会相交。 +线段以斜率和截距的形式给出,即double s1,double s2,double y1,double y2,分别代表直线1和2的斜率(即s1,s2)和截距(即y1,y2),请返回一个bool,代表给定的两条直线是否相交。这里两直线重合也认为相交。 + + +# 测试样例: +>3.14,1,3.14,2 + +>返回:false + +```java +import java.util.*; + +public class CrossLine { + public boolean checkCrossLine(double s1, double s2, double y1, double y2) { + // write code here + } +} +``` +[在线测试](http://www.nowcoder.com/practice/1efe2386491f4235b78a34cd1b5fb3d0?tpId=8&tqId=11027&rp=2&ru=/ta/cracking-the-coding-interview&qru=/ta/cracking-the-coding-interview/question-ranking) \ No newline at end of file diff --git "a/\347\254\254\344\271\235\345\221\250\344\275\234\344\270\232/\345\212\240\346\263\225\350\277\220\347\256\227\344\273\243\346\233\277.md" "b/\347\254\254\344\271\235\345\221\250\344\275\234\344\270\232/\345\212\240\346\263\225\350\277\220\347\256\227\344\273\243\346\233\277.md" new file mode 100644 index 0000000..c298d1a --- /dev/null +++ "b/\347\254\254\344\271\235\345\221\250\344\275\234\344\270\232/\345\212\240\346\263\225\350\277\220\347\256\227\344\273\243\346\233\277.md" @@ -0,0 +1,20 @@ +# 题目描述 +请编写一个方法,实现整数的乘法、减法和除法运算(这里的除指整除)。只允许使用加号。 +给定两个正整数int a,int b,同时给定一个int type代表运算的类型,1为求a * b,0为求a / b,-1为求a - b。请返回计算的结果,保证数据合法且结果一定在int范围内。 + +# 测试样例: +>1,2,1 + +>返回:2 + + +```java +import java.util.*; + +public class AddSubstitution { + public int calc(int a, int b, int type) { + // write code here + } +} +``` +[在线测试](http://www.nowcoder.com/practice/73f21c4e681f44be9517f215b7652eb8?tpId=8&tqId=11028&rp=2&ru=/ta/cracking-the-coding-interview&qru=/ta/cracking-the-coding-interview/question-ranking) \ No newline at end of file diff --git "a/\347\254\254\344\272\214\345\215\201\344\270\200\345\221\250\344\275\234\344\270\232/README.md" "b/\347\254\254\344\272\214\345\215\201\344\270\200\345\221\250\344\275\234\344\270\232/README.md" new file mode 100644 index 0000000..8ab2549 --- /dev/null +++ "b/\347\254\254\344\272\214\345\215\201\344\270\200\345\221\250\344\275\234\344\270\232/README.md" @@ -0,0 +1 @@ +本次开始为蓝桥本的训练试题,大家可以去蓝桥杯官网自己注册账号进行在线测试 \ No newline at end of file diff --git "a/\347\254\254\344\272\214\345\215\201\344\270\200\345\221\250\344\275\234\344\270\232/\345\207\272\347\216\260\346\254\241\346\225\260\346\234\200\345\244\232\345\276\227\346\225\260.md" "b/\347\254\254\344\272\214\345\215\201\344\270\200\345\221\250\344\275\234\344\270\232/\345\207\272\347\216\260\346\254\241\346\225\260\346\234\200\345\244\232\345\276\227\346\225\260.md" new file mode 100644 index 0000000..732cfd2 --- /dev/null +++ "b/\347\254\254\344\272\214\345\215\201\344\270\200\345\221\250\344\275\234\344\270\232/\345\207\272\347\216\260\346\254\241\346\225\260\346\234\200\345\244\232\345\276\227\346\225\260.md" @@ -0,0 +1,20 @@ + +## 试题 +  编写一个程序,读入一组整数,这组整数是按照从小到大的顺序排列的,它们的个数N也是由用户输入的,最多不会超过20。然后程序将对这个数组进行统计,把出现次数最多的那个数组元素值打印出来。如果有两个元素值出现的次数相同,即并列第一,那么只打印比较小的那个值。 +  输入格式:第一行是一个整数N,N £ 20;接下来有N行,每一行表示一个整数,并且按照从小到大的顺序排列。 +  输出格式:输出只有一行,即出现次数最多的那个元素值。 + +## 输入输出样例 + +**输入** +>   5 +100 +150 +150 +200 +250 + +**输出:** +>   150 + +[测试地址](http://lx.lanqiao.cn/problem.page?gpid=T222) \ No newline at end of file diff --git "a/\347\254\254\344\272\214\345\215\201\344\270\200\345\221\250\344\275\234\344\270\232/\345\211\215\347\274\200\350\241\250\350\276\276\345\274\217.md" "b/\347\254\254\344\272\214\345\215\201\344\270\200\345\221\250\344\275\234\344\270\232/\345\211\215\347\274\200\350\241\250\350\276\276\345\274\217.md" new file mode 100644 index 0000000..7826923 --- /dev/null +++ "b/\347\254\254\344\272\214\345\215\201\344\270\200\345\221\250\344\275\234\344\270\232/\345\211\215\347\274\200\350\241\250\350\276\276\345\274\217.md" @@ -0,0 +1,13 @@ +**问题描述** +  编写一个程序,以字符串方式输入一个前缀表达式,然后计算它的值。输入格式为:“运算符 对象1 对象2”,其中,运算符为“+”(加法)、“-”(减法)、“*”(乘法)或“/”(除法),运算对象为不超过10的整数,它们之间用一个空格隔开。要求:对于加、减、乘、除这四种运算,分别设计相应的函数来实现。 +  输入格式:输入只有一行,即一个前缀表达式字符串。 +  输出格式:输出相应的计算结果(如果是除法,直接采用c语言的“/”运算符,结果为整数)。 +**输入输出样例** +样例输入 +> + 5 2 + +样例输出 + +> 7 + +[测试地址](http://lx.lanqiao.cn/problem.page?gpid=T225) \ No newline at end of file diff --git "a/\347\254\254\344\272\214\345\215\201\344\270\211\345\221\250\344\275\234\344\270\232/\347\205\244\347\220\203\351\227\256\351\242\230.md" "b/\347\254\254\344\272\214\345\215\201\344\270\211\345\221\250\344\275\234\344\270\232/\347\205\244\347\220\203\351\227\256\351\242\230.md" new file mode 100644 index 0000000..f1b2b99 --- /dev/null +++ "b/\347\254\254\344\272\214\345\215\201\344\270\211\345\221\250\344\275\234\344\270\232/\347\205\244\347\220\203\351\227\256\351\242\230.md" @@ -0,0 +1,9 @@ +# 煤球数目 + +有一堆煤球,堆成三角棱锥形。具体: +第一层放1个, +第二层3个(排列成三角形), +第三层6个(排列成三角形), +第四层10个(排列成三角形), +.... +如果一共有100层,共有多少个煤球? diff --git "a/\347\254\254\344\272\214\345\215\201\344\270\211\345\221\250\344\275\234\344\270\232/\347\224\237\346\227\245\350\234\241\347\203\233.md" "b/\347\254\254\344\272\214\345\215\201\344\270\211\345\221\250\344\275\234\344\270\232/\347\224\237\346\227\245\350\234\241\347\203\233.md" new file mode 100644 index 0000000..2dca7f6 --- /dev/null +++ "b/\347\254\254\344\272\214\345\215\201\344\270\211\345\221\250\344\275\234\344\270\232/\347\224\237\346\227\245\350\234\241\347\203\233.md" @@ -0,0 +1,6 @@ +# 生日蜡烛 + +某君从某年开始每年都举办一次生日party,并且每次都要吹熄与年龄相同根数的蜡烛。 +现在算起来,他一共吹熄了236根蜡烛。 +请问,他从多少岁开始过生日party的? +请填写他开始过生日party的年龄数。 \ No newline at end of file diff --git "a/\347\254\254\344\272\214\345\215\201\344\272\214\345\221\250\344\275\234\344\270\232/Anagrams\351\227\256\351\242\230.md" "b/\347\254\254\344\272\214\345\215\201\344\272\214\345\221\250\344\275\234\344\270\232/Anagrams\351\227\256\351\242\230.md" new file mode 100644 index 0000000..b960a12 --- /dev/null +++ "b/\347\254\254\344\272\214\345\215\201\344\272\214\345\221\250\344\275\234\344\270\232/Anagrams\351\227\256\351\242\230.md" @@ -0,0 +1,12 @@ +问题描述 +  Anagrams指的是具有如下特性的两个单词:在这两个单词当中,每一个英文字母(不区分大小写)所出现的次数都是相同的。例如,“Unclear”和“Nuclear”、“Rimon”和“MinOR”都是Anagrams。编写一个程序,输入两个单词,然后判断一下,这两个单词是否是Anagrams。每一个单词的长度不会超过80个字符,而且是大小写无关的。 +  输入格式:输入有两行,分别为两个单词。 +  输出格式:输出只有一个字母Y或N,分别表示Yes和No。 +  输入输出样例 +样例输入 +Unclear +Nuclear +样例输出 +Y + +[在线测试](http://lx.lanqiao.cn/problem.page?gpid=T223) \ No newline at end of file diff --git "a/\347\254\254\344\272\214\345\215\201\344\272\214\345\221\250\344\275\234\344\270\232/\345\255\227\344\270\262\347\273\237\350\256\241.md" "b/\347\254\254\344\272\214\345\215\201\344\272\214\345\221\250\344\275\234\344\270\232/\345\255\227\344\270\262\347\273\237\350\256\241.md" new file mode 100644 index 0000000..7897f10 --- /dev/null +++ "b/\347\254\254\344\272\214\345\215\201\344\272\214\345\221\250\344\275\234\344\270\232/\345\255\227\344\270\262\347\273\237\350\256\241.md" @@ -0,0 +1,30 @@ +问题描述 +  给定一个长度为n的字符串S,还有一个数字L,统计长度大于等于L的出现次数最多的子串(不同的出现可以相交),如果有多个,输出最长的,如果仍然有多个,输出第一次出现最早的。 +输入格式 +  第一行一个数字L。 +  第二行是字符串S。 +  L大于0,且不超过S的长度。 +输出格式 +  一行,题目要求的字符串。 + +  输入样例1: +  4 +  bbaabbaaaaa + +  输出样例1: +  bbaa + +  输入样例2: +  2 +  bbaabbaaaaa + +  输出样例2: +  aa +数据规模和约定 +  n<=60 +  S中所有字符都是小写英文字母。 +提示 +  枚举所有可能的子串,统计出现次数,找出符合条件的那个 + + +[测试地址](http://lx.lanqiao.cn/problem.page?gpid=T219) \ No newline at end of file diff --git "a/\347\254\254\344\272\214\345\215\201\344\272\224\345\221\250\344\275\234\344\270\232/\346\234\272\345\231\250\344\272\272\350\265\260\346\226\271\346\240\274.md" "b/\347\254\254\344\272\214\345\215\201\344\272\224\345\221\250\344\275\234\344\270\232/\346\234\272\345\231\250\344\272\272\350\265\260\346\226\271\346\240\274.md" new file mode 100644 index 0000000..e67dc3c --- /dev/null +++ "b/\347\254\254\344\272\214\345\215\201\344\272\224\345\221\250\344\275\234\344\270\232/\346\234\272\345\231\250\344\272\272\350\265\260\346\226\271\346\240\274.md" @@ -0,0 +1,21 @@ +# 题目 + +有一个XxY的网格,一个机器人只能走格点且只能向右或向下走,要从左上角走到右下角。请设计一个算法,计算机器人有多少种走法。 +给定两个正整数int x,int y,请返回机器人的走法数目。保证x+y小于等于12。 + +# 考点 + +- 动态规划 +- 递归 + +# 测试样例: + +## 输入 +> 2,2 + +## 输出 +> 2 + +# 在线测试 + +[在线测试地址](https://www.nowcoder.com/practice/e8bb8e68434e42acbcdff0341f2a32c5?tpId=8&tqId=11033&tPage=1&rp=1&ru=/ta/cracking-the-coding-interview&qru=/ta/cracking-the-coding-interview/question-ranking) \ No newline at end of file diff --git "a/\347\254\254\344\272\214\345\215\201\345\205\255\345\221\250\344\275\234\344\270\232/20160904.png" "b/\347\254\254\344\272\214\345\215\201\345\205\255\345\221\250\344\275\234\344\270\232/20160904.png" new file mode 100644 index 0000000..9c849f4 Binary files /dev/null and "b/\347\254\254\344\272\214\345\215\201\345\205\255\345\221\250\344\275\234\344\270\232/20160904.png" differ diff --git "a/\347\254\254\344\272\214\345\215\201\345\205\255\345\221\250\344\275\234\344\270\232/\347\254\254\344\272\214\345\215\201\345\205\255\345\221\250\350\257\225\351\242\230.md" "b/\347\254\254\344\272\214\345\215\201\345\205\255\345\221\250\344\275\234\344\270\232/\347\254\254\344\272\214\345\215\201\345\205\255\345\221\250\350\257\225\351\242\230.md" new file mode 100644 index 0000000..9cf6d5c --- /dev/null +++ "b/\347\254\254\344\272\214\345\215\201\345\205\255\345\221\250\344\275\234\344\270\232/\347\254\254\344\272\214\345\215\201\345\205\255\345\221\250\350\257\225\351\242\230.md" @@ -0,0 +1,39 @@ +# 第二十六周作业 + +## 问题描述 +  G国国王来中国参观后,被中国的高速铁路深深的震撼,决定为自己的国家也建设一个高速铁路系统。 +  建设高速铁路投入非常大,为了节约建设成本,G国国王决定不新建铁路,而是将已有的铁路改造成高速铁路。现在,请你为G国国王提供一个方案,将现有的一部分铁路改造成高速铁路,使得任何两个城市间都可以通过高速铁路到达,而且从所有城市乘坐高速铁路到首都的最短路程和原来一样长。请你告诉G国国王在这些条件下最少要改造多长的铁路。 + +## 输入格式 +  输入的第一行包含两个整数n, m,分别表示G国城市的数量和城市间铁路的数量。所有的城市由1到n编号,首都为1号。 +  接下来m行,每行三个整数a, b, c,表示城市a和城市b之间有一条长度为c的双向铁路。这条铁路不会经过a和b以外的城市。 + +## 输出格式 +  输出一行,表示在满足条件的情况下最少要改造的铁路长度。 + +## 样例输入 + +>4 5 + +>1 2 4 + +>1 3 5 + +>2 3 2 + +>2 4 3 + +>3 4 2 + +## 样例输出 +11 + +## 评测用例规模与约定 +  对于20%的评测用例,1 ≤ n ≤ 10,1 ≤ m ≤ 50; +  对于50%的评测用例,1 ≤ n ≤ 100,1 ≤ m ≤ 5000; +  对于80%的评测用例,1 ≤ n ≤ 1000,1 ≤ m ≤ 50000; +  对于100%的评测用例,1 ≤ n ≤ 10000,1 ≤ m ≤ 100000,1 ≤ a, b ≤ n,1 ≤ c ≤ 1000。输入保证每个城市都可以通过铁路达到首都。 + +## 测试地址 + +[在线测试](http://115.28.138.223/view.page?gpid=T44) \ No newline at end of file diff --git "a/\347\254\254\344\272\214\345\215\201\345\221\250\344\275\234\344\270\232/201612-1.png" "b/\347\254\254\344\272\214\345\215\201\345\221\250\344\275\234\344\270\232/201612-1.png" new file mode 100644 index 0000000..8ebf87f Binary files /dev/null and "b/\347\254\254\344\272\214\345\215\201\345\221\250\344\275\234\344\270\232/201612-1.png" differ diff --git "a/\347\254\254\344\272\214\345\215\201\345\221\250\344\275\234\344\270\232/201612-2.png" "b/\347\254\254\344\272\214\345\215\201\345\221\250\344\275\234\344\270\232/201612-2.png" new file mode 100644 index 0000000..9e69f07 Binary files /dev/null and "b/\347\254\254\344\272\214\345\215\201\345\221\250\344\275\234\344\270\232/201612-2.png" differ diff --git "a/\347\254\254\344\272\214\345\215\201\345\233\233\345\221\250\344\275\234\344\270\232/\350\267\263\345\217\260\351\230\266.md" "b/\347\254\254\344\272\214\345\215\201\345\233\233\345\221\250\344\275\234\344\270\232/\350\267\263\345\217\260\351\230\266.md" new file mode 100644 index 0000000..7c2bbc7 --- /dev/null +++ "b/\347\254\254\344\272\214\345\215\201\345\233\233\345\221\250\344\275\234\344\270\232/\350\267\263\345\217\260\351\230\266.md" @@ -0,0 +1,6 @@ +# 题目描述 + +一只青蛙一次可以跳上1级台阶,也可以跳上2级。求该青蛙跳上一个n级的台阶总共有多少种跳法。 + +# 测试 +[在线测试地址](https://www.nowcoder.com/practice/8c82a5b80378478f9484d87d1c5f12a4?rp=1&ru=/ta/coding-interviews) \ No newline at end of file diff --git "a/\347\254\254\344\272\214\345\221\250\344\275\234\344\270\232/Max" "b/\347\254\254\344\272\214\345\221\250\344\275\234\344\270\232/Max" new file mode 100644 index 0000000..fa4092a --- /dev/null +++ "b/\347\254\254\344\272\214\345\221\250\344\275\234\344\270\232/Max" @@ -0,0 +1,12 @@ +public class Max +{ + public int getMax(int a , int b) + { + return (int)(((float)a+(float)b)/2 + Math.abs(((float)a-(float)b)/2)); + } + public static void main(String[] Args) + { + Max a = new Max(); + System.out.println(a.getMax(1, 20)); + } +} diff --git "a/\347\254\254\344\272\214\345\221\250\344\275\234\344\270\232/\344\272\225\345\255\227\346\243\213.PNG" "b/\347\254\254\344\272\214\345\221\250\344\275\234\344\270\232/\344\272\225\345\255\227\346\243\213.PNG" new file mode 100644 index 0000000..85fc169 Binary files /dev/null and "b/\347\254\254\344\272\214\345\221\250\344\275\234\344\270\232/\344\272\225\345\255\227\346\243\213.PNG" differ diff --git "a/\347\254\254\344\272\214\345\221\250\344\275\234\344\270\232/\346\227\240\345\210\244\346\226\255max.PNG" "b/\347\254\254\344\272\214\345\221\250\344\275\234\344\270\232/\346\227\240\345\210\244\346\226\255max.PNG" new file mode 100644 index 0000000..9a62520 Binary files /dev/null and "b/\347\254\254\344\272\214\345\221\250\344\275\234\344\270\232/\346\227\240\345\210\244\346\226\255max.PNG" differ diff --git "a/\347\254\254\344\272\224\345\221\250\345\256\236\351\252\214/\344\270\213\344\270\200\344\270\252\350\276\203\345\244\247\345\205\203\347\264\240.md" "b/\347\254\254\344\272\224\345\221\250\345\256\236\351\252\214/\344\270\213\344\270\200\344\270\252\350\276\203\345\244\247\345\205\203\347\264\240.md" new file mode 100644 index 0000000..4f99d3f --- /dev/null +++ "b/\347\254\254\344\272\224\345\221\250\345\256\236\351\252\214/\344\270\213\344\270\200\344\270\252\350\276\203\345\244\247\345\205\203\347\264\240.md" @@ -0,0 +1,24 @@ +# 题目描述 + +** 现在我们有一个int数组,请你找出数组中每个元素的下一个比它大的元素。 +给定一个int数组A及数组的大小n,请返回一个int数组,代表每个元素比他大的下一个元素,若不存在则为-1。保证数组中元素均为正整数。** +*** +>测试样例: + +>[11,13,10,5,12,21,3],7 +> +返回: + +>[13,21,12,12,21,-1,-1] + +*** +```java +import java.util.*; + +public class NextElement { + public int[] findNext(int[] A, int n) { + // write code here + } +} +``` +[在线测试](http://www.nowcoder.com/practice/11ae41035eef4ed9b354d0752f5abc6f?tpId=8&tqId=11067&rp=1&ru=/ta/cracking-the-coding-interview&qru=/ta/cracking-the-coding-interview/question-ranking) \ No newline at end of file diff --git "a/\347\254\254\344\272\224\345\221\250\345\256\236\351\252\214/\346\234\254\345\221\250\345\277\205\350\257\273.md" "b/\347\254\254\344\272\224\345\221\250\345\256\236\351\252\214/\346\234\254\345\221\250\345\277\205\350\257\273.md" new file mode 100644 index 0000000..92eb7a4 --- /dev/null +++ "b/\347\254\254\344\272\224\345\221\250\345\256\236\351\252\214/\346\234\254\345\221\250\345\277\205\350\257\273.md" @@ -0,0 +1,6 @@ +# 必读 + +## **把最近的学习问题和学习情况,总结一下,发给学长。** +邮箱:516094242@qq.com + +**务必** \ No newline at end of file diff --git "a/\347\254\254\344\272\224\345\221\250\345\256\236\351\252\214/\346\234\272\345\231\250\344\272\272\350\265\260\346\226\271\346\240\274.md" "b/\347\254\254\344\272\224\345\221\250\345\256\236\351\252\214/\346\234\272\345\231\250\344\272\272\350\265\260\346\226\271\346\240\274.md" new file mode 100644 index 0000000..bce599a --- /dev/null +++ "b/\347\254\254\344\272\224\345\221\250\345\256\236\351\252\214/\346\234\272\345\231\250\344\272\272\350\265\260\346\226\271\346\240\274.md" @@ -0,0 +1,25 @@ +# 题目描述 + +** 有一个XxY的网格,一个机器人只能走格点且只能向右或向下走,要从左上角走到右下角。请设计一个算法,计算机器人有多少种走法。 +给定两个正整数int x,int y,请返回机器人的走法数目。保证x+y小于等于12。** +*** +> 测试样例: + +> 2,2 + +>返回: + +>2 +*** + +```java +import java.util.*; + +public class Robot { + public int countWays(int x, int y) { + // write code here + } +} +``` + +[在线测试](http://www.nowcoder.com/practice/e8bb8e68434e42acbcdff0341f2a32c5?tpId=8&tqId=11033&rp=1&ru=/ta/cracking-the-coding-interview&qru=/ta/cracking-the-coding-interview/question-ranking) \ No newline at end of file diff --git "a/\347\254\254\345\205\253\345\221\250\344\275\234\344\270\232/\345\245\207\345\201\266\344\275\215\344\272\244\346\215\242.md" "b/\347\254\254\345\205\253\345\221\250\344\275\234\344\270\232/\345\245\207\345\201\266\344\275\215\344\272\244\346\215\242.md" new file mode 100644 index 0000000..4f96972 --- /dev/null +++ "b/\347\254\254\345\205\253\345\221\250\344\275\234\344\270\232/\345\245\207\345\201\266\344\275\215\344\272\244\346\215\242.md" @@ -0,0 +1,25 @@ +# 奇偶位交换 +## 题目描述 + +请编写程序交换一个数的二进制的奇数位和偶数位。(使用越少的指令越好) +给定一个int x,请返回交换后的数int。 +*** + +>测试样例: + +>10 + +>返回: + +>5 + +```java +import java.util.*; + +public class Exchange { + public int exchangeOddEven(int x) { + // write code here + } +} +``` +[在线测试](http://www.nowcoder.com/practice/ed7d014b42e740679c4bd69b9d9c49b9?tpId=8&tqId=11023&rp=2&ru=/ta/cracking-the-coding-interview&qru=/ta/cracking-the-coding-interview/question-ranking) \ No newline at end of file diff --git "a/\347\254\254\345\205\253\345\221\250\344\275\234\344\270\232/\347\251\272\346\240\274\346\233\277\346\215\242.md" "b/\347\254\254\345\205\253\345\221\250\344\275\234\344\270\232/\347\251\272\346\240\274\346\233\277\346\215\242.md" new file mode 100644 index 0000000..e96269c --- /dev/null +++ "b/\347\254\254\345\205\253\345\221\250\344\275\234\344\270\232/\347\251\272\346\240\274\346\233\277\346\215\242.md" @@ -0,0 +1,27 @@ +# 题目描述 + +请编写一个方法,将字符串中的空格全部替换为“%20”。假定该字符串有足够的空间存放新增的字符,并且知道字符串的真实长度(小于等于1000),同时保证字符串由大小写的英文字母组成。 +给定一个string iniString 为原始的串,以及串的长度 int len, 返回替换后的string。 +*** + +# 测试样例: + +>"Mr John Smith”,13 + +>返回:"Mr%20John%20Smith" + +>”Hello World”,12 + +>返回:”Hello%20%20World” + +```java +import java.util.*; + +public class Replacement { + public String replaceSpace(String iniString, int length) { + // write code here + } +} +``` + +[在线测试](http://www.nowcoder.com/practice/b0850698cb41449188344cdb647f3e99?tpId=8&tqId=10997&rp=1&ru=/ta/cracking-the-coding-interview&qru=/ta/cracking-the-coding-interview/question-ranking) \ No newline at end of file diff --git "a/\347\254\254\345\205\255\345\221\250\344\275\234\344\270\232/\344\272\214\350\277\233\345\210\266\346\217\222\345\205\245.md" "b/\347\254\254\345\205\255\345\221\250\344\275\234\344\270\232/\344\272\214\350\277\233\345\210\266\346\217\222\345\205\245.md" new file mode 100644 index 0000000..1751cb9 --- /dev/null +++ "b/\347\254\254\345\205\255\345\221\250\344\275\234\344\270\232/\344\272\214\350\277\233\345\210\266\346\217\222\345\205\245.md" @@ -0,0 +1,23 @@ +题目描述 + +有两个32位整数n和m,请编写算法将m的二进制数位插入到n的二进制的第j到第i位,其中二进制的位数从低位数到高位且以0开始。 +给定两个数int n和int m,同时给定int j和int i,意义如题所述,请返回操作后的数,保证n的第j到第i位均为零,且m的二进制位数小于等于i-j+1。 + +>测试样例: + +>1024,19,2,6 + +>返回: + +>1100 + +```java +import java.util.*; + +public class BinInsert { + public int binInsert(int n, int m, int j, int i) { + // write code here + } +} +``` +[在线测试](http://www.nowcoder.com/practice/30c1674ad5694b3f8f0bc2de6f005490?tpId=8&tqId=11019&rp=1&ru=/ta/cracking-the-coding-interview&qru=/ta/cracking-the-coding-interview/question-ranking) \ No newline at end of file diff --git "a/\347\254\254\345\205\255\345\221\250\344\275\234\344\270\232/\347\254\254k\344\270\252\346\225\260.md" "b/\347\254\254\345\205\255\345\221\250\344\275\234\344\270\232/\347\254\254k\344\270\252\346\225\260.md" new file mode 100644 index 0000000..b33ad3d --- /dev/null +++ "b/\347\254\254\345\205\255\345\221\250\344\275\234\344\270\232/\347\254\254k\344\270\252\346\225\260.md" @@ -0,0 +1,25 @@ +题目描述 + +有一些数的素因子只有3、5、7,请设计一个算法,找出其中的第k个数。 +给定一个数int k,请返回第k个数。保证k小于等于100。 + + +>测试样例: + +>3 + +>返回: + +>7 + +```java +import java.util.*; + +public class KthNumber { + public int findKth(int k) { + // write code here + } +} +``` + +[在线测试](http://www.nowcoder.com/practice/d5e776441a6e41ae9f9859413bdc1eca?tpId=8&tqId=11031&rp=3&ru=/ta/cracking-the-coding-interview&qru=/ta/cracking-the-coding-interview/question-ranking) \ No newline at end of file diff --git "a/\347\254\254\345\215\201\344\270\200\345\221\250\344\275\234\344\270\232/\345\260\217\347\220\203\347\232\204\350\267\235\347\246\273.md" "b/\347\254\254\345\215\201\344\270\200\345\221\250\344\275\234\344\270\232/\345\260\217\347\220\203\347\232\204\350\267\235\347\246\273.md" new file mode 100644 index 0000000..7521a08 --- /dev/null +++ "b/\347\254\254\345\215\201\344\270\200\345\221\250\344\275\234\344\270\232/\345\260\217\347\220\203\347\232\204\350\267\235\347\246\273.md" @@ -0,0 +1,23 @@ +#小球的距离 + +##题目描述 + +小东和三个朋友一起在楼上抛小球,他们站在楼房的不同层,假设小东站的楼层距离地面N米,球从他手里自由落下,每次落地后反跳回上次下落高度的一半,并以此类推知道全部落到地面不跳,求4个小球一共经过了多少米?(数字都为整数) +给定四个整数A,B,C,D,请返回所求结果 + +# 测试样例: +>100,90,80,70 + +>返回:1020 + +```java +import java.util.*; + +public class MaxGap { + public int findMaxGap(int[] A, int n) { + // write code here + } +} +``` + +[在线测试](http://www.nowcoder.com/practice/f5805cc389394cf69d89b29c0430ff27?tpId=49&tqId=29359&rp=5&ru=/ta/2016test&qru=/ta/2016test/question-ranking) \ No newline at end of file diff --git "a/\347\254\254\345\215\201\344\270\200\345\221\250\344\275\234\344\270\232/\345\267\246\345\217\263\346\234\200\345\200\274\346\234\200\345\244\247\345\267\256.md" "b/\347\254\254\345\215\201\344\270\200\345\221\250\344\275\234\344\270\232/\345\267\246\345\217\263\346\234\200\345\200\274\346\234\200\345\244\247\345\267\256.md" new file mode 100644 index 0000000..c86abe5 --- /dev/null +++ "b/\347\254\254\345\215\201\344\270\200\345\221\250\344\275\234\344\270\232/\345\267\246\345\217\263\346\234\200\345\200\274\346\234\200\345\244\247\345\267\256.md" @@ -0,0 +1,23 @@ +#左右最值最大差 + +##题目描述 + +给定一个长度为N(N>1)的整型数组A,可以将A划分成左右两个部分,左部分A[0..K],右部分A[K+1..N-1],K可以取值的范围是[0,N-2]。求这么多划分方案中,左部分中的最大值减去右部分最大值的绝对值,最大是多少? +给定整数数组A和数组的大小n,请返回题目所求的答案。 + +```java +import java.util.*; + +public class MaxGap { + public int findMaxGap(int[] A, int n) { + // write code here + } +} +``` + +# 测试样例: +>[2,7,3,1,1],5 + +>返回:6 + +[在线测试](http://www.nowcoder.com/practice/f5805cc389394cf69d89b29c0430ff27?tpId=49&tqId=29359&rp=5&ru=/ta/2016test&qru=/ta/2016test/question-ranking) \ No newline at end of file diff --git "a/\347\254\254\345\215\201\344\270\203\345\221\250\344\275\234\344\270\232/201509-1.png" "b/\347\254\254\345\215\201\344\270\203\345\221\250\344\275\234\344\270\232/201509-1.png" new file mode 100644 index 0000000..3ef0014 Binary files /dev/null and "b/\347\254\254\345\215\201\344\270\203\345\221\250\344\275\234\344\270\232/201509-1.png" differ diff --git "a/\347\254\254\345\215\201\344\270\203\345\221\250\344\275\234\344\270\232/201509-2.png" "b/\347\254\254\345\215\201\344\270\203\345\221\250\344\275\234\344\270\232/201509-2.png" new file mode 100644 index 0000000..71ebf54 Binary files /dev/null and "b/\347\254\254\345\215\201\344\270\203\345\221\250\344\275\234\344\270\232/201509-2.png" differ diff --git "a/\347\254\254\345\215\201\344\270\211\345\221\250\344\275\234\344\270\232/BaiduShurufa_2016-8-12_19-10-7.png" "b/\347\254\254\345\215\201\344\270\211\345\221\250\344\275\234\344\270\232/BaiduShurufa_2016-8-12_19-10-7.png" new file mode 100644 index 0000000..a900d63 Binary files /dev/null and "b/\347\254\254\345\215\201\344\270\211\345\221\250\344\275\234\344\270\232/BaiduShurufa_2016-8-12_19-10-7.png" differ diff --git "a/\347\254\254\345\215\201\344\270\211\345\221\250\344\275\234\344\270\232/BaiduShurufa_2016-8-12_19-8-25.png" "b/\347\254\254\345\215\201\344\270\211\345\221\250\344\275\234\344\270\232/BaiduShurufa_2016-8-12_19-8-25.png" new file mode 100644 index 0000000..c2f2a66 Binary files /dev/null and "b/\347\254\254\345\215\201\344\270\211\345\221\250\344\275\234\344\270\232/BaiduShurufa_2016-8-12_19-8-25.png" differ diff --git "a/\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232/201604-1.png" "b/\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232/201604-1.png" new file mode 100644 index 0000000..a4854b5 Binary files /dev/null and "b/\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232/201604-1.png" differ diff --git "a/\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232/201604-2\357\274\2101\357\274\211.png" "b/\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232/201604-2\357\274\2101\357\274\211.png" new file mode 100644 index 0000000..e16194e Binary files /dev/null and "b/\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232/201604-2\357\274\2101\357\274\211.png" differ diff --git "a/\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232/201604-2\357\274\2102\357\274\211.png" "b/\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232/201604-2\357\274\2102\357\274\211.png" new file mode 100644 index 0000000..9b8ed11 Binary files /dev/null and "b/\347\254\254\345\215\201\344\271\235\345\221\250\344\275\234\344\270\232/201604-2\357\274\2102\357\274\211.png" differ diff --git "a/\347\254\254\345\215\201\344\272\214\345\221\250\344\275\234\344\270\232/ccf2013121.png" "b/\347\254\254\345\215\201\344\272\214\345\221\250\344\275\234\344\270\232/ccf2013121.png" new file mode 100644 index 0000000..4756614 Binary files /dev/null and "b/\347\254\254\345\215\201\344\272\214\345\221\250\344\275\234\344\270\232/ccf2013121.png" differ diff --git "a/\347\254\254\345\215\201\344\272\214\345\221\250\344\275\234\344\270\232/ccf2013122.png" "b/\347\254\254\345\215\201\344\272\214\345\221\250\344\275\234\344\270\232/ccf2013122.png" new file mode 100644 index 0000000..beaea45 Binary files /dev/null and "b/\347\254\254\345\215\201\344\272\214\345\221\250\344\275\234\344\270\232/ccf2013122.png" differ diff --git "a/\347\254\254\345\215\201\344\272\214\345\221\250\344\275\234\344\270\232/readme.md" "b/\347\254\254\345\215\201\344\272\214\345\221\250\344\275\234\344\270\232/readme.md" new file mode 100644 index 0000000..cfcbb33 --- /dev/null +++ "b/\347\254\254\345\215\201\344\272\214\345\221\250\344\275\234\344\270\232/readme.md" @@ -0,0 +1,7 @@ +# 关于实验室日后的题型 + +现在的选题是学长要求从ccf计算机职业资格认证考试的真题。 + +先从每年的简单题开始。 + +唯独遗憾的是没有在线测试,没有答案,但是应该可以从网上找到。 \ No newline at end of file diff --git "a/\347\254\254\345\215\201\344\272\224\345\221\250\344\275\234\344\270\232/201412-1.png" "b/\347\254\254\345\215\201\344\272\224\345\221\250\344\275\234\344\270\232/201412-1.png" new file mode 100644 index 0000000..c683234 Binary files /dev/null and "b/\347\254\254\345\215\201\344\272\224\345\221\250\344\275\234\344\270\232/201412-1.png" differ diff --git "a/\347\254\254\345\215\201\344\272\224\345\221\250\344\275\234\344\270\232/201412-2.png" "b/\347\254\254\345\215\201\344\272\224\345\221\250\344\275\234\344\270\232/201412-2.png" new file mode 100644 index 0000000..3836fb7 Binary files /dev/null and "b/\347\254\254\345\215\201\344\272\224\345\221\250\344\275\234\344\270\232/201412-2.png" differ diff --git "a/\347\254\254\345\215\201\345\205\253\345\221\250\344\275\234\344\270\232/201512-1.png" "b/\347\254\254\345\215\201\345\205\253\345\221\250\344\275\234\344\270\232/201512-1.png" new file mode 100644 index 0000000..37d0f2d Binary files /dev/null and "b/\347\254\254\345\215\201\345\205\253\345\221\250\344\275\234\344\270\232/201512-1.png" differ diff --git "a/\347\254\254\345\215\201\345\205\253\345\221\250\344\275\234\344\270\232/201512-2.png" "b/\347\254\254\345\215\201\345\205\253\345\221\250\344\275\234\344\270\232/201512-2.png" new file mode 100644 index 0000000..c5e36d9 Binary files /dev/null and "b/\347\254\254\345\215\201\345\205\253\345\221\250\344\275\234\344\270\232/201512-2.png" differ diff --git "a/\347\254\254\345\215\201\345\205\255\345\221\250\344\275\234\344\270\232/201503-1.png" "b/\347\254\254\345\215\201\345\205\255\345\221\250\344\275\234\344\270\232/201503-1.png" new file mode 100644 index 0000000..01858c7 Binary files /dev/null and "b/\347\254\254\345\215\201\345\205\255\345\221\250\344\275\234\344\270\232/201503-1.png" differ diff --git "a/\347\254\254\345\215\201\345\205\255\345\221\250\344\275\234\344\270\232/201503-2.png" "b/\347\254\254\345\215\201\345\205\255\345\221\250\344\275\234\344\270\232/201503-2.png" new file mode 100644 index 0000000..7e7530f Binary files /dev/null and "b/\347\254\254\345\215\201\345\205\255\345\221\250\344\275\234\344\270\232/201503-2.png" differ diff --git "a/\347\254\254\345\215\201\345\221\250\344\275\234\344\270\232/\345\217\230\346\200\201\350\267\263\345\217\260\351\230\266.md" "b/\347\254\254\345\215\201\345\221\250\344\275\234\344\270\232/\345\217\230\346\200\201\350\267\263\345\217\260\351\230\266.md" new file mode 100644 index 0000000..1236474 --- /dev/null +++ "b/\347\254\254\345\215\201\345\221\250\344\275\234\344\270\232/\345\217\230\346\200\201\350\267\263\345\217\260\351\230\266.md" @@ -0,0 +1,15 @@ +# 变态跳台阶 + +## 题目描述 + +一只青蛙一次可以跳上1级台阶,也可以跳上2级……它也可以跳上n级。求该青蛙跳上一个n级的台阶总共有多少种跳法。 + +```java +public class Solution { + public int JumpFloorII(int target) { + + } +} +``` + +[在线测试](http://www.nowcoder.com/practice/22243d016f6b47f2a6928b4313c85387?tpId=13&tqId=11162&rp=1&ru=/ta/coding-interviews&qru=/ta/coding-interviews/question-ranking) \ No newline at end of file diff --git "a/\347\254\254\345\215\201\345\221\250\344\275\234\344\270\232/\346\261\2021+2+3+...+n.md" "b/\347\254\254\345\215\201\345\221\250\344\275\234\344\270\232/\346\261\2021+2+3+...+n.md" new file mode 100644 index 0000000..b78386a --- /dev/null +++ "b/\347\254\254\345\215\201\345\221\250\344\275\234\344\270\232/\346\261\2021+2+3+...+n.md" @@ -0,0 +1,15 @@ +# 求1+2+3+...+n + +## 题目 + +求1+2+3+...+n,要求不能使用乘除法、for、while、if、else、switch、case等关键字及条件判断语句(A?B:C)。 + +```java +public class Solution { + public int Sum_Solution(int n) { + + } +} +``` + +[在线测试](http://www.nowcoder.com/practice/7a0da8fc483247ff8800059e12d7caf1?tpId=13&tqId=11200&rp=1&ru=/ta/coding-interviews&qru=/ta/coding-interviews/question-ranking) \ No newline at end of file diff --git "a/\347\254\254\345\215\201\345\233\233\345\221\250\344\275\234\344\270\232/README.md" "b/\347\254\254\345\215\201\345\233\233\345\221\250\344\275\234\344\270\232/README.md" new file mode 100644 index 0000000..2da612d --- /dev/null +++ "b/\347\254\254\345\215\201\345\233\233\345\221\250\344\275\234\344\270\232/README.md" @@ -0,0 +1,12 @@ +README + +# 注册账号 + +ccf考试账号 +点击个人注册 + +[注册](http://www.cspro.org/lead/application/ccf/login.jsp) + +试题地址: + +[试题](http://www.cspro.org/lead/leadbpm.do?__action=goto_iframe&path=CCF_KS_KSLX_LIST&djtype=TT&2) \ No newline at end of file diff --git "a/\347\254\254\345\215\201\345\233\233\345\221\250\344\275\234\344\270\232/ccf20140901.png" "b/\347\254\254\345\215\201\345\233\233\345\221\250\344\275\234\344\270\232/ccf20140901.png" new file mode 100644 index 0000000..dea768c Binary files /dev/null and "b/\347\254\254\345\215\201\345\233\233\345\221\250\344\275\234\344\270\232/ccf20140901.png" differ diff --git "a/\347\254\254\345\215\201\345\233\233\345\221\250\344\275\234\344\270\232/ccf20140902.png" "b/\347\254\254\345\215\201\345\233\233\345\221\250\344\275\234\344\270\232/ccf20140902.png" new file mode 100644 index 0000000..614fdd7 Binary files /dev/null and "b/\347\254\254\345\215\201\345\233\233\345\221\250\344\275\234\344\270\232/ccf20140902.png" differ diff --git "a/\347\254\254\345\233\233\345\221\250\344\275\234\344\270\232/2\347\232\204\344\270\252\346\225\260.md" "b/\347\254\254\345\233\233\345\221\250\344\275\234\344\270\232/2\347\232\204\344\270\252\346\225\260.md" new file mode 100644 index 0000000..1f3c06d --- /dev/null +++ "b/\347\254\254\345\233\233\345\221\250\344\275\234\344\270\232/2\347\232\204\344\270\252\346\225\260.md" @@ -0,0 +1,25 @@ +# 题目描述 + +**请编写一个方法,输出0到n(包括n)中数字2出现了几次。** + +给定一个正整数n,请返回0到n的数字中2出现了几次。 + +>测试样例: + +>10 + +>返回: + +>1 + +```java +import java.util.*; + +public class Count2 { + public int countNumberOf2s(int n) { + // write code here + } +} +``` +*** +**[在线测试](http://www.nowcoder.com/practice/31a9495eb02844fb8c0e9ab101053f53?tpId=8&tqId=11066&rp=4&ru=/ta/cracking-the-coding-interview&qru=/ta/cracking-the-coding-interview/question-ranking)** \ No newline at end of file diff --git "a/\347\254\254\345\233\233\345\221\250\344\275\234\344\270\232/\347\241\254\345\270\201\350\241\250\347\244\272.md" "b/\347\254\254\345\233\233\345\221\250\344\275\234\344\270\232/\347\241\254\345\270\201\350\241\250\347\244\272.md" new file mode 100644 index 0000000..a22944a --- /dev/null +++ "b/\347\254\254\345\233\233\345\221\250\344\275\234\344\270\232/\347\241\254\345\270\201\350\241\250\347\244\272.md" @@ -0,0 +1,25 @@ +# 题目描述 +*** +**有数量不限的硬币,币值为25分、10分、5分和1分,请编写代码计算n分有几种表示法。** + +给定一个int n,请返回n分有几种表示法。保证n小于等于100000,为了防止溢出,请将答案Mod 1000000007。 + +>测试样例: + +>6 + +>返回: + +>2 + +```java +import java.util.*; + +public class Coins { + public int countWays(int n) { + // write code here + } +} +``` + +**[在线测试](http://www.nowcoder.com/practice/c0503ca0a12d4256af33fce2712d7b24?tpId=8&tqId=11041&rp=3&ru=/ta/cracking-the-coding-interview&qru=/ta/cracking-the-coding-interview/question-ranking)** \ No newline at end of file