自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

菜鸟

too difficult

  • 博客(12)
  • 收藏
  • 关注

原创 51nod 1256 乘法逆元

模板题目,扩展欧几里得#include using namespace std;int a,b,x,y;int exGcd(int a, int b, int& x, int& y){ if (b == 0) { x = 1; y = 0; return a; } int g = exGcd(b,a%b,x,y); int tmp =

2015-11-28 16:52:57 768

原创 lightOJ 1005 - Rooks

简单的数学题,排列组合的问题#include #include using namespace std;typedef long long ll;ll c(ll m, ll n){ ll ans = 1, i; for (i = 1; i <= n ; i++) { ans *= m - i + 1; ans /= i; } return ans;}in

2015-11-24 00:02:09 506

原创 lightOJ 1174 - Commandos

dijkstra算法,这就是模板题啊。。。#include #include #include #include #include #include #include using namespace std;const int MAX_V = 105;const int INF = 0x3f3f3f3f;int numV,numE,st,ed;typedef

2015-11-22 17:56:58 556

原创 lightOJ 1019 - Brush (V)

挑战上面有模板#include #include #include #include using namespace std;const int MAX_V = 105;const int INF = 0x3f3f3f3f;int V,E;int d[MAX_V];int used[MAX_V];int G[MAX_V][MAX_V];void dijkstra(int

2015-11-21 23:29:58 555

转载 LCA 算法之tarjan 和 并查集

这两个地址看了就懂了在这个网站看并查集:http://www.nocow.cn/index.php/%E5%B9%B6%E6%9F%A5%E9%9B%86tarjan算法:http://noalgo.info/476.html#include #include #include #include using namespace std;const int MAX

2015-11-21 12:04:27 758

原创 POJ 1330 Nearest Common Ancestors

模板题。。。。#include #include #include using namespace std;const int MAX=10005;vector G[MAX];int depth[MAX];int parent[MAX];int root, n;bool vis[MAX];void dfs(int v, int p, int d){ parent[v

2015-11-20 00:18:37 330

原创 lightOJ 1227 - Boiled Eggs

贪心,一定要先sort一遍。。。。。。#include #include #include using namespace std;int arr[35];int main(){ std::ios::sync_with_stdio(false); int T,cas=0; cin >> T; while (T--) { int n,p,q,res=0,

2015-11-19 20:08:52 779

原创 lightOJ 1008 - Fibsieve`s Fantabulous Birthday

//观察每个小的方阵,就是不停的平方啊!!!然后找规律#include #include #include using namespace std;int main(){ int T,cas=0; cin >> T; while(T--) { long long num; cin >> num; double tmp = sqrt(double(num)); tmp = tmp==(int)t

2015-11-18 22:55:30 463

原创 lightOj 1107 - How Cow

#include #include using namespace std;int main(){ int T,cas=0; cin>>T; while(T--) { double x1,y1,x2,y2; cin>>x1>>y1>>x2>>y2; int t; cin>>t; printf("Case %d:\n",++cas)

2015-11-18 01:52:15 517

原创 lightOj1006 Hex-a-bonacci

#include #include using namespace std;const int mode=10000007;int main(){ int T,cas=0; cin>>T; int arr[10001]={0}; while(T--) { int a,b,c,d,e,f,n; cin>>a>>b>>c>>d>>e>>f>>n;

2015-11-17 16:36:39 546

原创 一维多项式求值

//describe: 计算一维多项式的值//arr是存的系数,n代表一共有多少项,x就是输入啦#include using namespace std;double cal(double x,int n,double arr[]){ double tmp=arr[n-1]; for(int i=n-2;i>=0;--i) { tmp=tmp*x+arr[i];

2015-11-14 12:53:50 568

转载 c++虚函数

原文地址:http://blog.csdn.net/haoel/article/details/1948051/C++中的虚函数的作用主要是实现了多态的机制。关于多态,简而言之就是用父类型别的指针指向其子类的实例,然后通过父类的指针调用实际子类的成员函数。这种技术可以让父类的指针有“多种形态”,这是一种泛型技术。所谓泛型技术,说白了就是试图使用不变的代码来实现可变的算法。比

2015-11-06 21:36:54 453

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除