这个题目是个水题目,现在我只管做出来,效率不考虑了。 题目链接: http://acm.nyist.net/JudgeOnline/problem.php?pid=904 我用hashmap 很爽,很简单,但效率很低,别人有的是用二分查找,不管了, package nyoj904;import ja...
分类:
其他好文 时间:
2014-06-25 22:42:59
阅读次数:
301
其实就是容斥原理了代码: 1 uses math; 2 const maxn=55000; 3 var i,n,a,b,c,d,w,tot:longint; 4 ans:int64; 5 sum,mu,p:array[0..maxn] of int64; 6 procedure ge...
分类:
其他好文 时间:
2014-06-25 22:10:01
阅读次数:
299
题目链接:http://poj.org/problem?id=1195
纯纯的二维树状数组,不解释,只需要注意一点,由于题目中的数组从0开始计算,所以维护的时候需要加1。因为树状数组的下标是不能为1的
代码:
#include
#include
#define N 1030
using namespace std;
int c[N][N];
int cas,n,x,y,a,l,b,r,t...
分类:
其他好文 时间:
2014-06-24 21:15:14
阅读次数:
154
做了一下午,总算做出来了!!
思路:将R转换成整数,同时计算好小数的个数,计算整数的次幂之后,然后根据规律将小数点适当的时候输出(如有3位实际小数,则应在第36位输出小数点)
链接http://acm.nyist.net/JudgeOnline/problem.php?pid=155
代码:
#include
#include
int main()
{
int i, j, n, do...
分类:
其他好文 时间:
2014-06-24 21:01:10
阅读次数:
164
传送门 http://poj.org/problem?id=1135
建模分两部分:1、如果最后是关键牌倒下,那么找最短路中最长的就行--最远的倒下,其他的牌一定倒下,所以找最远的最短路
2、如果最后是普通牌倒下,那么找三角形,三角形周长的一半就是倒下的位置
到底是情况1还是情况2,自己在脑子模拟一下就能想到,还是那句话,最难倒下的倒...
分类:
其他好文 时间:
2014-06-24 18:47:11
阅读次数:
117
Problem DescriptionSome days ago, I learned the concept of LCM (least common multiple). I've played with it for several times and I want to make a big...
分类:
其他好文 时间:
2014-06-24 15:01:58
阅读次数:
168
BackgroundAfter trying to solve problem EDIT1(Editor) and being ****ed by Brainf**k, Blue Mary decided to set another difficult problem about editor.D...
分类:
其他好文 时间:
2014-06-24 11:43:44
阅读次数:
245
N-QueensThe n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.Given an integer n, retu...
分类:
其他好文 时间:
2014-06-22 13:10:11
阅读次数:
188
题目链接:http://codeforces.com/problemset/problem/216/D
题意:
对于一个梯形区域,如果梯形左边的点数!=梯形右边的点数,那么这个梯形为红色,否则为绿色,
问:
给定的蜘蛛网中有多少个红色。
2个树状数组维护2个线段。然后暴力模拟一下,因为点数很多但需要用到的线段树只有3条,所以类似滚动数组的思想优化内存。
#include
#includ...
分类:
Web程序 时间:
2014-06-22 07:11:35
阅读次数:
205
Super Mario
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 2183 Accepted Submission(s): 1061
Problem Description
Mario is world-fam...
分类:
其他好文 时间:
2014-06-21 23:43:29
阅读次数:
397