摘要:
#includeint main(){ int n,m,s,i; scanf("%d",&n); for(m=2;m<n;m++) { s=0; for(i=1;i<m;i++) if((m%i)==0) s=s+i; ... 阅读全文
posted @ 2015-01-09 19:02
zach96
阅读(108)
评论(0)
推荐(0)
摘要:
#includestatic int arr[100];void main(){ void solve(int people,int spacing); int people,spacing,i,j=0; printf("请输入总人数(2-99):"); scanf("%d",&people); p... 阅读全文
posted @ 2015-01-09 19:01
zach96
阅读(142)
评论(0)
推荐(0)
摘要:
#include #include #include using namespace std;int arry[13]= {0,31,28,31,30,31,30,31,31,30,31,30,31};bool is_bisse(int year){ if((year % 4 == 0 && ... 阅读全文
posted @ 2015-01-09 18:59
zach96
阅读(158)
评论(0)
推荐(0)
摘要:
#include int main(){ int n,i; int a[45]={2,3}; scanf("%d",&n); for (i=2;iusing namespace std;int main(){ int i; __int64 n,fib[45] = ... 阅读全文
posted @ 2015-01-09 18:57
zach96
阅读(412)
评论(0)
推荐(0)
摘要:
#includeint leap(int year){ int leap; leap=year%4==0&&year%100!=0||year%400==0; return (leap);}int main(){ int mon[]= {0,28,31,30,31,30,31... 阅读全文
posted @ 2015-01-09 18:55
zach96
阅读(197)
评论(0)
推荐(0)
摘要:
1 #include 2 #include 3 #include 4 using namespace std; 5 #define mod 1003 6 7 int quick_power(int a, int b) 8 { 9 if(a == 0) return 0;10 int ret... 阅读全文
posted @ 2015-01-09 18:54
zach96
阅读(135)
评论(0)
推荐(0)
摘要:
#include #include int main(){ char a[101],b[101]; int i,j,k,cas,count=1,num2,num3; scanf("%d",&cas); getchar(); while (cas--) { ... 阅读全文
posted @ 2015-01-09 18:53
zach96
阅读(126)
评论(0)
推荐(0)
摘要:
#include#includeusing namespace std;long long a[1000001];char c[1000001];int main(){ int i=2; cin>>a[1]; int ans=0; while(scanf("%c",&c[i++])!=EOF) s... 阅读全文
posted @ 2015-01-09 18:52
zach96
阅读(134)
评论(0)
推荐(0)
摘要:
注意:只有一个鞍点可证#includeint main(){ int i,j,k,max,maxj,flag; //int a[3][4]={{1,2,3,4},{5,6,7,8},{9,10,11,12} }; int a[3][4]={{1,2,3,13},{5,6,8,7},... 阅读全文
posted @ 2015-01-09 18:51
zach96
阅读(156)
评论(0)
推荐(0)
摘要:
#include float p(int n,float x){ if(n==0) return (1); else if(n==1) return (x); else return (((2*n-1)*x-p((n-1),x)-(n-1)*p((n-2),x))... 阅读全文
posted @ 2015-01-09 18:50
zach96
阅读(240)
评论(0)
推荐(0)
摘要:
这个问题挺有名的,贴代码:#include "stdio.h"void main( ){ //FILE *fp; int i=1; double x=500.0,s=1000.0,oil; //fp=fopen("data.dat","w"); do { //fprintf(fp,"No=%-7d... 阅读全文
posted @ 2015-01-09 18:49
zach96
阅读(185)
评论(0)
推荐(0)
摘要:
#include #include #include using namespace std;#define maxn 100010struct N{ int l, r, max;} tree[maxn * 3]; //注意乘三int num[maxn];void build(int node... 阅读全文
posted @ 2015-01-09 18:44
zach96
阅读(223)
评论(0)
推荐(0)
摘要:
#include #include void process(int b[10][10],int m){ int i,j,k; i=0,j=m/2; b[i][j]=1; for(k=2;k=m)) {i+=2;j--;} if (i=m) j=0; if (b[i][j]!=0) {i+=2;j... 阅读全文
posted @ 2015-01-09 18:41
zach96
阅读(282)
评论(1)
推荐(0)
摘要:
#include void main(){ int i,j,k,N,count; int data[20][20]={0}; printf("Input an integer N:"); scanf("%d",&N); //count=0; count=N*N; for(k=0;kk;i--) ... 阅读全文
posted @ 2015-01-09 18:38
zach96
阅读(355)
评论(0)
推荐(0)
摘要:
#include #include #include using namespace std;#define maxn 100010int main(){ int T; char c[maxn]; scanf("%d", &T); while(T--) { ... 阅读全文
posted @ 2015-01-09 18:36
zach96
阅读(118)
评论(0)
推荐(0)
摘要:
#include#includeint alph(char c){ if((c>='a'&&c='A'&&clength) { length=len; place=point; } flag=1; len=0; } return(place);}void main(){... 阅读全文
posted @ 2015-01-09 18:32
zach96
阅读(210)
评论(0)
推荐(0)
摘要:
#include#includeint f1(float(*p)[5]){ int i,j; float k,s=0; for(i=0; im) { m=p[i][j]; row=i; ... 阅读全文
posted @ 2015-01-09 18:30
zach96
阅读(220)
评论(0)
推荐(0)
摘要:
/*贪心策略:1,如果田忌的最快马快于齐王的最快马,则两者比。(因为若是田忌的别的马很可能就赢不了了,所以两者比)2,如果田忌的最快马慢于齐王的最快马,则用田忌的最慢马和齐王的最快马比。(由于所有的马都赢不了齐王的最快马,所以用损失最小的,拿最慢的和他比)3,若相等,则比较田忌的最慢马和齐王的最慢马... 阅读全文
posted @ 2015-01-09 09:42
zach96
阅读(180)
评论(0)
推荐(0)
摘要:
#include#includeusing namespace std;int a[10010]= {0},b[10010]= {0};int main(){ int z=0,m; while (scanf("%d",&m)==1&&m) { z++; ... 阅读全文
posted @ 2015-01-09 09:41
zach96
阅读(117)
评论(0)
推荐(0)
摘要:
http://www.2cto.com/kf/201310/253108.html o(n+m)的复杂度 水 龙有n个头 m个骑士 能力值为x的骑士可以砍掉龙的一个半径不超过x的头 要花x的money 求最小花费砍光头 不行输出Loowater is doomed! 龙有n个头 m个骑士 能力值为x 阅读全文
posted @ 2015-01-09 09:40
zach96
阅读(151)
评论(0)
推荐(0)
摘要:
#include int f (__int64 n){ int a,b=0; while(n>0) { a=n%10; if(a==8) { b=1; break; } ... 阅读全文
posted @ 2015-01-09 09:39
zach96
阅读(99)
评论(0)
推荐(0)
摘要:
FatMouse准备了M磅的Cat-Food,以便用来跟小Cat交换好吃的JavaBean。 现在有N个房间,第i个房间有J[i]磅的JavaBean,其交换的筹码是F[i]磅的Cat-Food。 当然,FatMouse还是有很大的选择权的,对任意一个房间,它可以只交换一部分的Cat-Food。 现 阅读全文
posted @ 2015-01-09 09:38
zach96
阅读(233)
评论(0)
推荐(0)
摘要:
#include#include#includeusing namespace std;int main(){int a[1001],b[1001],flag[1001]={0}; int m,z=0,k; while(~scanf("%d",&m)) {if(m==0)break... 阅读全文
posted @ 2015-01-09 09:37
zach96
阅读(113)
评论(0)
推荐(0)
摘要:
#include #include #include #include #include using namespace std;const int maxn = 1111l;int n;int c;int a[maxn];int main(){ while (scanf("%d%d", &n... 阅读全文
posted @ 2015-01-09 09:36
zach96
阅读(174)
评论(0)
推荐(0)
摘要:
#include#include#includeusing namespace std;const int N=1e3+10;int a[N],p[N];void print_permutation(int n,int *p,int *a,int cur){ int i,j; if(cu... 阅读全文
posted @ 2015-01-09 09:33
zach96
阅读(157)
评论(0)
推荐(0)
摘要:
#include#includeconst int N=1e3+10;int a[N];void f(int n,int *a,int cur)//一共有n个元素,从第cur个开始排{ int i,j; if(cur==n) //递归边界:当cur=n时,说明从0~n-1共n个元素已经全... 阅读全文
posted @ 2015-01-09 09:32
zach96
阅读(150)
评论(0)
推荐(0)
摘要:
插入的经典:#include#define N 1000int main(){ void bi_search(int a[],int n,int x); int a[N],i,m,x; printf("please input the length:"); scanf("%d... 阅读全文
posted @ 2015-01-09 09:29
zach96
阅读(249)
评论(0)
推荐(0)
摘要:
来源NOIP2008提高组题目描述给你n根火柴棍,你可以拼出多少个形如“A+B=C”的等式?等式中的A、B、C是用火柴棍拼出的整数(若该数非零,则最高位不能是0)。用火柴棍拼数字0-9的拼法如图所示:注意:1. 加号与等号各自需要两根火柴棍2. 如果A≠B,则A+B=C与B+A=C视为不同的等式(A... 阅读全文
posted @ 2015-01-09 09:25
zach96
阅读(252)
评论(0)
推荐(0)
摘要:
直接贴代码#include"stdio.h"#include"string.h"int main(){ int n=5; int a[5]= {81,60,51,35,73}; int q=n,m,p,s,k,i=0,temp; while(q) { p=... 阅读全文
posted @ 2015-01-09 09:20
zach96
阅读(143)
评论(0)
推荐(0)
摘要:
注意和快排的区别啊!!!#include#includevoid Merge(int sourceArr[],int tempArr[],int startIndex,int midIndex,int endIndex){ int i,j,k; for(i=midIndex+1,j=st... 阅读全文
posted @ 2015-01-09 09:19
zach96
阅读(136)
评论(0)
推荐(0)
摘要:
sort的原函数在两个变量绑定时,无法直接用sort直接贴代码,没什么好描述的#include"stdio.h"void quiksort(int a[],int low,int high){ int i = low; int j = high; int temp = a[i]; ... 阅读全文
posted @ 2015-01-09 09:18
zach96
阅读(164)
评论(0)
推荐(0)
摘要:
#include #define N 1000int main() { void f1(int a[],int n); int a[N],i,m; printf("please input the length:"); scanf("%d",&m); for(... 阅读全文
posted @ 2015-01-09 09:16
zach96
阅读(136)
评论(0)
推荐(0)
摘要:
#include #define N 1000int main(){ void f1(int a[],int n); int a[N],i,m; printf("please input the length:"); scanf("%d\n",&m); for(i=0;... 阅读全文
posted @ 2015-01-09 09:15
zach96
阅读(206)
评论(0)
推荐(0)
摘要:
这个问题就不写描叙了啊直接贴代码#includevoid move(char x,char y){ printf("%c-->%c\n",x,y);}void hanoi(int n,char one,char two,char three){ if(n==1) move(... 阅读全文
posted @ 2015-01-09 09:13
zach96
阅读(107)
评论(0)
推荐(0)
摘要:
八皇后问题八皇后问题,是一个古老而著名的问题,是回溯算法的典型案例。该问题是国际西洋棋棋手马克斯·贝瑟尔于1848年提出:在8X8格的国际象棋上摆放八个皇后,使其不能互相攻击,即任意两个皇后都不能处于同一行、同一列或同一斜线上,问有多少种摆法。 高斯认为有76种方案。1854年在柏林的象棋杂志上不同... 阅读全文
posted @ 2015-01-09 09:09
zach96
阅读(589)
评论(0)
推荐(0)

浙公网安备 33010602011771号