p,r用double类型,pat多题如果用float会WA AC代码 #include <vector> #include <cstdio> #include <cmath> using namespace std; int main(){ int n; double p,r; scanf("%d
分类:
其他好文 时间:
2016-03-10 23:41:24
阅读次数:
188
先找出m新郎来错排,剩下的n-m对就是正常的。所以是f(m)*c(m,n) 错排 f(n)=(n-1)*(f(n-1)+f(n-2)) c(m,n)=n!/(m!*(n-m)!) #include <iostream> #include <cstring> using namespace std;
分类:
其他好文 时间:
2016-03-10 23:26:53
阅读次数:
262
三维空间的DFS,挺新颖的一题 AC代码: #include <vector> #include <cstdio> #include <queue> using namespace std; int x[] = {0,0,1,0,-1,0}; int y[] = {0,1,0,-1,0,0}; in
分类:
其他好文 时间:
2016-03-10 23:22:09
阅读次数:
166
a x b = c 将a,b,c用out统一输出 AC代码: #include <cstdio> #include <string> using namespace std; long long gcd(long long x,long long y){ if(x == 0) return y; i
分类:
其他好文 时间:
2016-03-10 21:43:16
阅读次数:
129
蚂蚁掉头等于不掉头。 #include<cstdio> #include<cstring> #include<cmath> #include<stack> #include<algorithm> using namespace std; const int maxn=1000000+10; int
分类:
其他好文 时间:
2016-03-10 20:33:58
阅读次数:
191
#include "HelloWorldScene.h" USING_NS_CC; #define RED_BIT_MASK 0b0100 #define GREEN_BIT_MASK 0b0010 #define BLUE_BIT_MASK 0b0001 #define EDGE_BIT_MASK
分类:
其他好文 时间:
2016-03-10 20:21:23
阅读次数:
168
简单贪心。注意输出格式,每到80个字符就换一行。 #include<cstdio> #include<cstring> #include<cmath> #include<stack> #include<algorithm> using namespace std; const int maxn =
分类:
其他好文 时间:
2016-03-10 20:15:31
阅读次数:
158
#include<iostream> #include<cmath> #include<cstring> #include<cstdio> #include<algorithm> #include<queue> #include<stack> using namespace std; const i
分类:
其他好文 时间:
2016-03-10 17:25:46
阅读次数:
204
SHA1和MD5加密均为不可逆加密。代码如下: using System.Security.Cryptography; //添加Using static void Main(string[] args) { string password = "0123456789"; //SHA1加密方法 var
大话设计模式中的利用反射加抽象工厂的数据访问程序。先来看看反射技术的基本格式:--反射工廠 Assembly.Load(“程序集名称”).CreateInstance(“命名空间.类名称”); 只要在程序顶端写上using System.Reflection来引用Reflection,就可以采用反射
分类:
其他好文 时间:
2016-03-10 14:25:31
阅读次数:
178