上一页 1 ··· 31 32 33 34 35 36 37 38 39 ··· 42 下一页
摘要: 细节题1,注意输出2,当a[i].sum有偶数个时,前一半比后一半多53,当只有一个时,除100,50以外,输出90,80,70,60等等之类的View Code 1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string.h> 4 #include<iostream> 5 #include<algorithm> 6 #include<queue> 7 #include<map> 8 #include<math.h> 9 using name 阅读全文
posted @ 2012-12-07 23:53 xxx0624 阅读(319) 评论(0) 推荐(0) 编辑
摘要: View Code 1 /* 2 DP 3 n个数,奇数步相加,偶数步相减 4 */ 5 #include<stdio.h> 6 #include<stdlib.h> 7 #include<string.h> 8 #include<iostream> 9 #include<algorithm>10 #include<queue>11 #include<map>12 #include<math.h>13 using namespace std;14 const int maxn = 150005;15 阅读全文
posted @ 2012-12-07 22:02 xxx0624 阅读(202) 评论(0) 推荐(0) 编辑
摘要: 找规律:n=1 ans=0;n=2 ans=1;n=3 ans=1;.....if( n%2==1 ) ans=ans*2-1;else ans=ans*2+1;View Code 1 import java.util.Scanner; 2 import java.math.*; 3 //import java.text.*; 4 //import java.lang.*; 5 public class b{ 6 public static void main( String srga[] ){ 7 Scanner cin=new Scanner( System.in... 阅读全文
posted @ 2012-12-06 19:13 xxx0624 阅读(440) 评论(0) 推荐(0) 编辑
摘要: View Code 1 /* 2 最大连续子序列和 3 输出 ans 和 首元素,尾元素 4 */ 5 6 /* 7 //TLE 只适合处理小型数据 8 #include<stdio.h> 9 #include<string.h>10 #include<stdlib.h>11 #include<algorithm>12 #include<iostream>13 #include<queue>14 using namespace std;15 const int maxn = 10005;16 int a[ maxn ];1 阅读全文
posted @ 2012-12-04 14:28 xxx0624 阅读(414) 评论(0) 推荐(0) 编辑
摘要: 产生一个素数换DFSView Code 1 /* 2 DFS, 形成素数环 3 */ 4 #include<stdio.h> 5 #include<stdlib.h> 6 #include<string.h> 7 #define maxn 24 8 int num[ maxn ],vis[ maxn ]; 9 bool prime( int a ){10 for( int i=2;i<=(a+1)/2;i++ ){11 if( a%i==0 ) return false;12 }13 return true;14 }15 void dfs( int . 阅读全文
posted @ 2012-11-25 10:47 xxx0624 阅读(528) 评论(0) 推荐(0) 编辑
摘要: View Code 1 /* 2 模拟 3 */ 4 #include<stdio.h> 5 int main(){ 6 int a,b,n; 7 int f[ 105 ]; 8 while( scanf("%d%d%d",&a,&b,&n)==3,a+b+n ){ 9 f[1]=1;10 f[2]=1;11 //printf("1\n1\n");12 for(int i=3;i<=49;i++){13 f[i]=f[i-1]*a+f[i-2]*b;14 f... 阅读全文
posted @ 2012-11-22 10:59 xxx0624 阅读(412) 评论(3) 推荐(0) 编辑
摘要: View Code 1 /* 2 无向 最短路 3 spfa 4 */ 5 #include<stdio.h> 6 #include<string.h> 7 #include<iostream> 8 #include<algorithm> 9 #include<queue> 10 #include<stack> 11 #define maxn 100005 12 const long long inf = 12345678987654321LL; 13 typedef long long ll; 14 using name 阅读全文
posted @ 2012-11-18 18:49 xxx0624 阅读(209) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。 阅读全文
posted @ 2012-10-23 16:44 xxx0624 阅读(8) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。 阅读全文
posted @ 2012-10-23 15:21 xxx0624 阅读(20) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 #define N 1005 7 #define inf 9999999 8 int map[N][N],path[N],flow[N]; 9 int start,eend,ans,n,m;10 11 int bfs(){12 int t,i;13 queueq;14 while(!q.empty())q.pop();15 memset(path,-1,sizeof(path));... 阅读全文
posted @ 2012-10-22 22:40 xxx0624 阅读(288) 评论(0) 推荐(0) 编辑
上一页 1 ··· 31 32 33 34 35 36 37 38 39 ··· 42 下一页