这个算法很好的解决了闰年的比较,同时也解决了每个月的月初和上个月的末尾不好判断的问题,简单的来说就是用日历和时间差比对/** * 是否为今天 */-
(BOOL)isToday{ NSCalendar *calendar = [NSCalendar currentCalendar]; ...
分类:
其他好文 时间:
2014-05-26 12:40:09
阅读次数:
209
UVA 10843 - Anne's game
题目链接
题意:题意说得挺绕的,其实本质上就是求n个点,可以接连出多少种不同的生成树
思路:这是Caylay定理,网上能找到证明,结果为nn?2,然后利用快速幂去求解。
代码:
#include
#include
const int long long MOD = 2000000011;
int t;
long long n;...
分类:
其他好文 时间:
2014-05-26 03:36:35
阅读次数:
278
Problem Description
Teacher HU and his 40 students were trapped by the brigands. To show their power, the head of the brigands want to select one people to kill.
Teacher HU and his 40 students wil...
分类:
其他好文 时间:
2014-05-25 18:19:44
阅读次数:
306
Problem Description
Have you ever played quoit in a playground? Quoit is a game in which flat rings are pitched at some toys, with all the toys encircled awarded.
In the field of Cyberground, the ...
分类:
其他好文 时间:
2014-05-25 11:13:53
阅读次数:
245
Problem Description
Teacher HU and his 40 students were trapped by the brigands. To show their power, the head of the brigands want to select one people to kill.
Teacher HU and his 40 students wil...
分类:
其他好文 时间:
2014-05-25 10:02:35
阅读次数:
309
Flip GameDescriptionFlip game is played on a
rectangular 4x4 field with two-sided pieces placed on each of its 16 squares.
One side of each piece is w...
分类:
其他好文 时间:
2014-05-25 03:21:52
阅读次数:
255
【题目】
Given an array of non-negative integers, you are initially positioned at the first index of the array.
Each element in the array represents your maximum jump length at that position.
Determine if you are able to reach the last index.
For example:...
分类:
其他好文 时间:
2014-05-24 20:44:39
阅读次数:
221
之所以说leetcode的测试用例有问题,是因为我刚开始理解错了题意,写下了如下的错误的代码。但是却AC了。
错误代码为:
bool canJump(int A[], int n) {
if(n == 0) return true;
int sum = 0; //记录当前的最远距离
int i = 0;
...
分类:
其他好文 时间:
2014-05-24 19:45:57
阅读次数:
1081
Android 通过应用设置系统日期和时间的方法
android 2.3
android 4.0
测试可行,不过需要ROOT权限.
import java.io.DataOutputStream;
import java.io.File;
import java.io.IOException;
import java.util.Calendar;
import android.os....
分类:
移动开发 时间:
2014-05-24 18:22:41
阅读次数:
316
1 package com.tai.use; 2 3 import
java.text.DateFormat; 4 import java.text.SimpleDateFormat; 5 import
java.util.Calendar; 6 import java.util.Date; 7.....
分类:
其他好文 时间:
2014-05-24 11:51:15
阅读次数:
302