标题来源:POJ 3047 Bovine Birthday 意甲冠军:.. . 思考:式 适合于1582年(中国明朝万历十年)10月15日之后的情形 公式 w = y + y/4 + c/4 - 2*c + 26 * (m+1)/10 + d - 1; m假设是1 2 月份 y要倒退1年 m += 12 y是年份的后两位 y = year%100 c是世纪 c = year/100   #include <cstdio> #include <cstring> using names…
#!/usr/bin/env python # encoding: utf-8 #coding=utf-8 date_star={ ':'星期一', ':'星期二', ':'星期三', ':'星期四', ':'星期五', ':'星期六', ':'星期日', } def caile(*args): year,month,day = args month = int(month) day = int(day) year_one,year_two = int(str(year)[:2]),int(st…
“模拟“题,运用哈希,不断地按照一定运算规律对一个结果进行计算,如果重复出现就停止并且输出该数.注意到仔细看题,这种题一定要细心! POJ - 2183 Bovine Math Geniuses Time Limit: 1000MS Memory Limit: 65536KB 64bit IO Format: %I64d & %I64u Description Farmer John loves to help the cows further their mathematical skills…
POJ 3259 Wormholes(最短路径,求负环) Description While exploring his many farms, Farmer John has discovered a number of amazing wormholes. A wormhole is very peculiar because it is a one-way path that delivers you to its destination at a time that is BEFORE…
/** * Created by liangjiahao on 2017/2/26. * 运用泽勒一致性计算某天是星期几? * 公式: * h = (q + 26(m+1)/10 + k +k/4 + j/4 +5j) % 7 * */ import java.util.Scanner; public class Zeller { public static void main(String args[]){ Scanner imput = new Scanner(System.in); Sys…
Beauty Contest http://poj.org/problem?id=2187 题目描述:输入n对整数点,求最距离远的点对,输出他们距离的平方和 算法:拿到这个题,最朴素的想法就是用2层循环遍历所有的点对,但这样可能会超时.由于距离最远的点对必定在点集的凸包的顶点上,所以只用遍历凸包上的点对就行.这样就把可能存在的大量的点给排除.哈哈~~~还是凸包. #include <iostream> #include <algorithm> #include <iomani…
Wall Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 28462   Accepted: 9498 Description Once upon a time there was a greedy King who ordered his chief Architect to build a wall around the King's castle. The King was so greedy, that he wo…
题目链接:http://poj.org/problem?id=1329 输出很蛋疼,要考虑系数为0,输出也不同 #include<cstdio> #include<cstring> #include<cmath> #include<iostream> #include<algorithm> #include<queue> using namespace std; ; const double PI = acos(-1.0); cons…
题目链接:http://poj.org/problem?id=2299 题目大意:给定n个数,要求这些数构成的逆序对的个数. 可以采用归并排序,也可以使用树状数组 可以把数一个个插入到树状数组中, 每插入一个数, 统计比他小的数的个数,对应的逆序为 i- getsum( data[i] ),其中 i 为当前已经插入的数的个数, getsum( data[i] )为比 data[i] 小的数的个数,i- getsum( data[i] ) 即比 data[i] 大的个数, 即逆序的个数.最后需要把…
题目连接:problemId=542" target="_blank">ZOJ 1542 POJ 1861 Network 网络 Network Time Limit: 2 Seconds      Memory Limit: 65536 KB      Special Judge Andrew is working as system administrator and is planning to establish a new network in his com…