`
to_zoe_yang
  • 浏览: 139376 次
  • 性别: Icon_minigender_2
  • 来自: 01
社区版块
存档分类
最新评论
文章列表

Problem 7

问题描述: By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the 10001st prime number? public static boolean IsPrime(long number) { int begin = 2; int end = (int) Math.sqrt(number) + 1; for (int i = begin; i < end; i++) { if (n ...

Problem 6

问题描述: The sum of the squares of the first ten natural numbers is, 12 + 22 + ... + 102 = 385 The square of the sum of the first ten natural numbers is, (1 + 2 + ... + 10)2 = 552 = 3025 Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is 3 ...

Problem 5

问题描述: 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20? 求出1~20的最小公倍数. 思路如下: //辗转相除法求最大公倍数 public long count_gcd(long a, long b){ long ...

Problem 3

问题描述: The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? 找出一个数字的最大因子。 public static boolean IsPrime(long number) { int begin = 2; int end = (int) Math.sqrt(number) + 1; for (int i = begin; i < end; i++) { if (number % i == ...

Problem 4

A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91  99. Find the largest palindrome made from the product of two 3-digit numbers. 找到满足一下两个条件的数 1.回文数 2.由两个三位数相乘可得 //判断是否是回文数 public static boolean is_palindrome(int numb ...

Problem2

问题描述 Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the ev ...

天气小工具

  昨天我们得到了全国的省份,市,区的三级信息。我们就应该让用户能选择。 通过使用JComboBox我们可以显示出选项,并且在用户作出一个当前选择时,影响下一个选择! 方便起见,我们初始选择都是空,每当用户选择了省份,就跟根据选择省份改变市和区。 以省份的JComboBox为例: 其中ProvinceAndCity中提供了很多得到省份,市和区信息的方法。 provinceBox.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent ...

Problem 1

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000. public int Counnt1(){ int result = 0; int begin =3; int end = 1000; long t1 = System.currentTimeMilli ...
   自己的手机上下了个天气工具,感觉非常棒!自己就想实现一下!      目前的想法就是从提供天气信息的网站上获得相关信息并提取!      http://www.weather.com.cn/     这个网站提供的天气信息非常好,格式也非常符合标准!      信息抓取工具:HttpWatcher 装好HttpWatcher后,在网页中启动HttpWatcher,在IE中输入http://www.weather.com.cn/,并选中一个城市,闭关会抓取网页信息。 这个就不详述了。。。 通过对抓取到的信息的分析,得到一个城市的天气的网页URL为http://www.weather.c ...
【IT168技术文档】     Unicode是一种字符编码规范 。     先从ASCII说起。ASCII是用来表示英文字符的一种编码规范,每个ASCII字符占用1个字节(8bits)     因此,ASCII编码可以表示的最大字符数是256,其实英文字符并没有那 ...

堆排序

因为要观察稳定性,就自己定义数据元素 package sorted.util; /* * Element用作排序算法的元素,value为其对应的值,index为其最开始时的下标 * index主要用来观察稳定行 */ public class Element { private int value ; private int index ; public int getValue() { return value; } public void setValue(int value) { this.value = value; } p ...

选择排序

选择排序是这样实现的:    设数组内存放了n个待排数字,数组下标从1开始,到n结束。    i=1    从数组的第i个元素开始到第n个元素,寻找最小的元素。    将上一步找到的最小元素和第i位元素交换。    如果i=n-1算法结束,否则回到第3步 public static void selectSort(int array[]){ for(int i=0; i<array.length; i++){ int index = i; int max = array[i] ; //退出循环时,index表示最大的数的位置 for(int j= ...
  使用Java中的URL 和 HttpURLConnection 就可以实现模拟网页登陆!   分析登陆的协议,可以使用HttpWatcher,蛮好用的! 目前就两种网页请求方式 Get和Post 我们可以自己先写好这两个方法,以便之后调用 这个就是Get请求方式了,参数就是URL地址 public static String get(String url) { System.out.println("get>>>" + url); URL serverUrl; HttpURLConnection conn; StringBu ...
   VC开发的程序,要美化!设置透明,弄点背景,能稍微好看点!     Static Text和GroupBox就可以设置透明!     只需要处理WM_CTLCOLOR消息就可以了!此消息是针对控件进行设置的!很好用!     IDC_STATIC_NAME为空间的ID啦~ HBRUSH CConfigureDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) { HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); // TODO: Change any attrib ...
tableName代表数据库中的表 fieldName代表需要查询的数据库表中的列名 cond代表查询的条件表达式, cond.getCondition()得到具体的表达式 查询函数 public static List<Map<String, Object>> query(Connection con, String tableName, String[] fieldName, Condition cond){ List<Map<String, Object>> result = new ArrayList<Map& ...
Global site tag (gtag.js) - Google Analytics