- 博客(24)
- 收藏
- 关注
原创 sgu122
122. The booktime limit per test: 0.5 sec. memory limit per test: 4096 KBThere is a group of N (2<=N<=1000) people which are numbered 1 through N, and everyone of them has not less than [ (N
2012-04-26 15:42:30 2058
原创 sgu121
121. Bridges paintingtime limit per test: 0.5 sec. memory limit per test: 4096 KBNew Berland consists of N (1£N£100) islands, some of them are connected by bridges. There can be no more than
2012-04-25 15:42:27 909
原创 sgu132
132. Another Chocolate Maniactime limit per test: 0.5 sec. memory limit per test: 4096 KBBob really LOVESchocolate. He thinks he never gets enough. Imagine his joy when his parentstold him t
2012-04-25 09:18:07 1596 1
原创 sgu131
1131. Hardwood floortime limit per test: 0.5 sec. memory limit per test: 4096 KBThe banquet hall of Computer Scientists' Palace has a rectangular form of the size M x N (11) rectangles
2012-04-24 15:04:30 1520 1
原创 poj1185
炮兵阵地Time Limit: 2000MSMemory Limit: 65536KTotal Submissions: 11808Accepted: 4266Description司令部的将军们打算在N*M的网格地图上部署他们的炮兵部队。一个N*M的地图由N行M列组成,地图的每一格可能是山地(用"H" 表示),也可能是平原(
2012-04-20 07:32:22 552
原创 sgu223
223. Little Kingstime limit per test: 1 sec.memory limit per test: 65536 KBinput: standardoutput: standardAfter solving nice problems about bishops and rooks, Petya decided that he
2012-04-19 21:34:55 1731
原创 sgu124
124. Broken linetime limit per test: 0.5 sec. memory limit per test: 4096 KBThere is a closed broken line on a plane with sides parallel to coordinate axes, without self-crossings and self-con
2012-04-10 12:55:42 626
原创 sgu116
筛法找质数,然后背包一下/* *NAME:Index of super-prime *LANG:C++ *Source:sgu116 */#include #include #include #include #include using namespace std;bool check[10101];int prime[8000];int n,k;struct
2012-04-07 08:11:20 629
原创 sgu111
模拟一下开方的过程,至于如何开方,百度一下,这里不再赘述#include #include #include #include #include #include #include #include #include using namespace std;typedef int digit;class bigNum{public: vector a;
2012-04-06 19:56:35 694
原创 spoj_15_SHPATH
题目数据范围比较高,用map记录城市,再用dijkstra+heap既可以了AC了/* *NAME:SHPATH *LANG:C++ *Source:spoj15 */#include #include #include #include #include #include #include #include #define INF 0x7FFFFFFFusing
2012-04-06 11:11:53 594
原创 sgu123
。。。。费波拿起数前N项和。/* *NAME:sum *LANG:C++ *Source:sgu123 */#include #include #include #include #include #include #include #include using namespace std;int k;typedef int digit;class bigNum
2012-04-06 10:00:33 478
原创 sgu115
日历问题。。。。。#include #include #include #include #include #include #define printIm cout << "Impossible" << endl;using namespace std;bool ka(int i,int j,int w){ if (w>i || w<=j) return true;
2012-04-06 09:34:25 500
原创 sgu114
给出X轴正半轴上所有的一些点,并且有权值,要求找到一个点,到这些点的距离*权值最小,小学数学题。。。#include #include #include #include #include #include #include using namespace std;int n;pair city[15100];;long long sum=0,sum1=0;
2012-04-06 09:05:12 645
原创 sgu113
。。。。判断一个数能否由两个质数组成。。。/* *NAME:Nearly prime numbers *LANG:C++ *Source:sgu113 */#include #include #include #include #include using namespace std;int t,n,num,k;int prime[7000];bool check[
2012-04-05 16:04:52 501
原创 sgu112
这就是高精度的应用,最基础的乘法和减法。#include #include #include #include #include #include #include using namespace std;int a,b;string sa,sb;typedef int digit;class bigNum{private: vector a; in
2012-04-05 13:55:16 594
原创 sgu106
106. The equationtime limit per test: 0.5 sec. memory limit per test: 4096 KBThere is an equation ax + by + c = 0. Given a,b,c,x1,x2,y1,y2 you must determine, how many integer roots of this eq
2012-04-05 10:38:17 3044 4
原创 sgu108
这道题目看似很水,其实巧妙的处理还是很值得学习的。题目大意就是找出一个数,使得这个数不能被某个数S+该数S每一位上的数字的和组成。暴力搜了一下,这样要开一个10^7的判断数组,加上一个100万的答案数组。这样显然是超空间的。对于判断数组我们可以建一个0-63的数组滚动一下,因为7位数,每一位上的和最多=63.对于答案数组,我们可以对于询问进行双关键字排序,最后取出即可
2012-04-04 11:36:04 825
原创 sgu107
这就是一道找找规律的题目,只要找出所有9位数的平方的后面9位为987654321的数有几个就可一了。/* *NAME:987654321problem *LANG:C++ *Source:sgu107 */#include #define pZero printf("%d",0)#define rep(i,p) for (int i=0;i<p;++i)using name
2012-04-04 11:06:03 451
原创 SPOJ_4_ONP
中缀转后缀,没什么好说的/* *NAME: ONP *LANG: C++ */#include #include #include using namespace std;int n;string s;void solve(string s){ int stack = 0,pos=0; string tmp1="",tmp2=""; if (s[
2012-04-03 12:42:29 450
原创 Sgu105
目测SGU中最水的一题,找到规律就行了/* *NAME:DIV 3 *LANG:C++ *Source:sgu105 */#include using namespace std;int n,ans;int main(){ cin >> n; cout << ((n/3*2)+(n%3==2)) << endl;}
2012-04-02 22:52:39 435
原创 Sgu104
花店橱窗问题,不用多说了吧,是人都知道。/* *Name:Little shop of flowers *LANG:C++ *Source:sgu104 */#include #include #define INF -0x7FFFFFFF/2using namespace std;int a[200][200],ff[200][200];int f,v,max=IN
2012-04-02 22:51:35 584
原创 sgu103
狗题,其实就是很简单的最短路问题的扩展,一开始不明就理的TLE,MLE,WA,蛋碎了一地,后来发现题目说没有路径就输出0,突然醒悟了!/* *Name:Traffic Lights *LANG:C++ *source:sgu103 */#include #include #include #define MAXN 350#define MAXM 15000#define I
2012-04-02 22:49:53 529
原创 sgu102
这是一道水题,判断两个数是否是质因数就可一了/* *Name:coprimes *LANG: C++ *Source:sgu102 */#include #include #include #include #include #include using namespace std;int ans=1,n;bool check[10001];int gc
2012-04-02 11:28:58 440
原创 Sgu101
这道题是求一条能够连通所有骨牌的路径,一开始我吧骨牌当作节点,但这样明显是要超时的,后来经过讨论其实可以吧骨牌上的数字当作节点,骨牌当作边,这样做一遍Hierholzer's algorithm,找到一条记录顶点编号的欧拉路径,再从顶点搜索,直到吧边的序号搜索出来即可/* *Name: Domino *LANG: C++ *Source: sgu101 */#incl
2012-04-02 08:35:44 804
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人