- 博客(22)
- 收藏
- 关注
转载 九度OJ 1004
#include<stdio.h> #include<algorithm> using namespace std; int a[2000005]; int main() { int n,m; while(scanf("%d",&n)!=EOF) { for(int i=0; i<n; i...
2014-04-15 23:24:00
127
转载 九度OJ 1003
#include<stdio.h> #include<string> #include<iostream> using namespace std; int main() { char a[20],b[20]; while(scanf("%s%s",a,b) != EOF) { int na...
2014-04-12 23:54:00
133
转载 九度OJ 1002
#include<stdio.h> #include<math.h> #include<algorithm> using namespace std; int main() { int p,t,g1,g2,g3,gj; while(scanf("%d %d %d %d %d %d",&p,&t,&am...
2014-04-11 13:35:00
125
转载 九度OJ 1553
http://ac.jobdu.com/problem.php?pid=1553 /* 时针和分针位mod12,之和再mod6计算大角度, 时针和分针的位置关系分4种情况讨论 然后加上时针小角度的转动。 */ #include<stdio.h> int main() { int h,m; while(scanf("%d%*c...
2014-04-04 07:28:00
113
转载 codeforces 141A
1 #include<iostream> 2 #include<vector> 3 #include<cstring> 4 #include<cstdio> 5 using namespace std; 6 string sortString(string s) 7 { 8 for(int i=0;...
2013-08-28 11:11:00
138
转载 codeforces 50A
http://codeforces.com/problemset/problem/50/A #include<cstdio> #include<iostream> using namespace std; int main() { int n,m,i; while(cin>>m>>n) { if(n%2==0) co...
2013-08-20 20:34:00
213
转载 codeforces 118A
http://codeforces.com/problemset/problem/118/A 1 #include<iostream> 2 #include<string> 3 #include<queue> 4 using namespace std; 5 string a; 6 queue<char>b; ...
2013-08-12 23:05:00
161
转载 codeforces 71A
http://codeforces.com/problemset/problem/71/A 1 #include<iostream> 2 #include<string> 3 using namespace std; 4 string a; 5 int main() 6 { 7 int n; 8 cin>&...
2013-08-12 22:30:00
151
转载 hdu1175 bfs
// hdu 1175 #include <iostream> #include <cstring> #include <cstdio> #include <queue> using namespace std; struct node { int x , y ; int step ; }s,e; ...
2013-07-26 16:10:00
94
转载 priority_queue
#include<iostream> #include<functional> #include<queue> using namespace std; struct node { friend bool operator<(node n1,node n2) { return n1.priori...
2013-07-25 23:21:00
75
转载 最小生成树-Kruskal算法模板
#include<iostream> #include<cstdio> #include<algorithm> using namespace std; #define maxn 11 #define maxm 20 struct edge { int u,v,w; }edges[maxm]; int father[ma...
2013-07-22 23:18:00
88
转载 hdu 1213 并查集
http://acm.hdu.edu.cn/showproblem.php?pid=1213 #include<iostream> #include<cstdio> using namespace std; #define N 1000 int father[N]; void ufset() { for(int i=0;i<N;i...
2013-07-22 11:36:00
87
转载 hdu1702 list or stack+queue
http://acm.hdu.edu.cn/showproblem.php?pid=1702 #include<iostream> #include<cstdio> #include<cstring> #include<list> using namespace std; int main() { // freop...
2013-07-22 00:14:00
92
转载 codeforces 330B
http://codeforces.com/problemset/problem/330/B 题解: 关键在于 m < n/2, 即必存在一个点能跟所有点相连,那么只用找出这么一个能连接所有点的点。 然后输出的边肯定只有n-1条。 #include<iostream> #include<cstdio> #include<cstring>...
2013-07-21 10:26:00
165
转载 codeforces 330A
http://codeforces.com/problemset/problem/330/A #include<iostream> #include<cstdio> #include<cstring> using namespace std; int row[10][10],col[10][10]; char s[10][10]; i...
2013-07-21 09:39:00
145
转载 hdu1394 线段树求最小逆序数
hdu 1394 http://acm.hdu.edu.cn/showproblem.php?pid=1394 用线段树求逆序数,例如要求x的逆序数只需要访问(x+1,n)段有多少个数,就是x的逆序数。还有就是求最小逆序数的时候有个巧妙的想法,当把x放入数组的后面,此时的逆序数应该为x没放入最后面之前的逆序总数加上(n-x)再减去(x-1);sum = sum+(n-x[i])-...
2013-07-21 01:58:00
181
转载 Hdu1754-线段树-单点更新
#include<iostream> #include<cstdio> #include<algorithm> using namespace std; #define lson l,m,rt<<1 #define rson m+1,r,rt<<1|1 const int maxn=200005; int MA...
2013-07-20 16:28:00
79
转载 Hdu1166-- 线段树模板
#include<iostream> #include<cstdio> using namespace std; #define lson l,m,rt<<1 #define rson m+1,r,rt<<1|1 const int maxn=555555; int sum[maxn<<2]; void pus...
2013-07-20 15:56:00
102
转载 Largest product in a grid( Project Euler problem 11)
In the 2020 grid below, four numbers along a diagonal line have been marked in red. 08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 0849 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 ...
2013-07-17 09:10:00
143
转载 Smallest multiple
#include<iostream> #include<algorithm> using namespace std; int lcm(int a ,int b) { int big=max(a,b); int small=min(a,b); int max=a*b; for(int i=big; i<ma...
2013-07-15 21:59:00
201
转载 Largest palindrome product
https://projecteuler.net/problem=4 1、它是回文数 2、存在2个三位数乘积等于它。 1 #include<iostream> 2 #include<cstdio> 3 using namespace std; 4 bool is_ok(int x) 5 { 6 if(x%10!=x/10...
2013-07-15 20:37:00
62
转载 codeforces-320A-Magic Numbers
http://codeforces.com/problemset/problem/320/A A magic number is a number formed by concatenation of numbers 1, 14 and 144. We can use each of these numbers any number of times. Therefore 1414...
2013-06-27 23:37:00
210
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人