上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 26 下一页
摘要: http://acm.fzu.edu.cn/problem.php?pid=2024View Code #include<stdio.h>#include<string.h>#define M 1010int c[M][M];int f[M][M];int min(int a,int b,int c){ int z=(a<b)?a:b; if(z<c)return z; else return c;}int Max(int a ,int b){return a>b?a:b;}void LCS(char aa[], char bb[], int x, i 阅读全文
posted @ 2011-05-02 09:15 聊聊IT那些事 阅读(214) 评论(0) 推荐(0) 编辑
摘要: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3501View Code #include<iostream>#include<algorithm>#include<string.h>#include<cstdio>using namespace std;char a[][15]={"0", "I", "II", "III", "IV", "V", &q 阅读全文
posted @ 2011-05-01 17:22 聊聊IT那些事 阅读(381) 评论(1) 推荐(0) 编辑
摘要: http://acm.fzu.edu.cn/problem.php?pid=2014好办法!View Code #include"iostream"using namespace std;int today[]={0,31,28,31,30,31,30,31,31,30,31,30,31};bool L_y(int year){ if(year%4==0&&year%100||year%400==0) return true; return false;}int main(){ int n; while(scanf("%d",&n 阅读全文
posted @ 2011-04-30 11:08 聊聊IT那些事 阅读(267) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1038简单题,关键是读懂题;View Code #include"iostream"#define Pi 3.1415927using namespace std;int main(){ double d,c,t; double sum ,v; int j=0; while(scanf("%lf%lf%lf",&d,&c,&t)!=EOF) { if(c==0) break; sum=(Pi*d*c)/(12*5280); v=1.0*(sum* 阅读全文
posted @ 2011-04-29 07:32 聊聊IT那些事 阅读(503) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2565简单题:i+j<n-1,是对图形的上半部分空格的控制。i>j , 是对图形下半部分空格的控制。View Code #include"iostream"using namespace std;int main(){ int t; int n; cin>>t; while(t--) { int i,j; cin>>n; for(i=0;i<n;i++) { for(j=0;j<n;j++) { if(i==j||i+j==n-1) cout 阅读全文
posted @ 2011-04-27 08:49 聊聊IT那些事 阅读(315) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2102复习了一遍队列,借鉴了网上的一些不错的方法,学习了!View Code #include<iostream>#include<cstdio>#include<queue>#define M 11using namespace std;char map[2][M][M];int set[2][M][M];int Dir[4][2]={{1 , 0},{0 , 1},{-1 , 0},{0 , -1}};int n,m,t;int mx,my,mz;int i,j,k;s 阅读全文
posted @ 2011-04-25 19:52 聊聊IT那些事 阅读(561) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2100一个26进制的大数加法,View Code #include<iostream>#include<cmath>#define M 201using namespace std;char ch1[M],ch2[M];int a[M] ,b[M] ;int c[M];int i,j,k;int main(){ while(cin>>ch1>>ch2) { int L1=strlen(ch1); int L2=strlen(ch2); int flag=0; / 阅读全文
posted @ 2011-04-25 17:58 聊聊IT那些事 阅读(420) 评论(0) 推荐(0) 编辑
摘要: 末尾的0可以直接输出,j精度问题减小了不少,这样相对效率高些! 不错的方法啊!View Code #include"stdio.h"#include"math.h"int _Max(int x, int y){ return x>y?x:y;}int main(){ int t; int n,m,i; int a[31]; int sum; int mark,x; scanf("%d",&t); while(t--) { scanf("%d %d",&n,&m); for(i=1;i& 阅读全文
posted @ 2011-04-25 15:19 聊聊IT那些事 阅读(319) 评论(0) 推荐(0) 编辑
摘要: View Code //从反面考虑:就是一个offer都没获得,最后结果p=1-p;#include"iostream"#include"algorithm"using namespace std;struct offer{ int a; double b;}s[10000];int cmp(offer x, offer y){ return x.b>y.b;}int main(){ int n,m; int i; while(cin>>n>>m,n+m) { for(i=0;i<m;i++) scanf(" 阅读全文
posted @ 2011-04-22 19:42 聊聊IT那些事 阅读(1293) 评论(1) 推荐(1) 编辑
摘要: 纯规律题:找到n=3时,分割数为20,从而可发现2,8, 20之间差的关系正好是6的倍数。View Code #include"iostream"using namespace std;int a[10000];int main(){ int t; int n; cin>>t; while(t--) { cin>>n; a[1]=2; for(int i=2;i<=n;i++) a[i]=a[i-1]+6*(i-1); cout<<a[n]<<endl; } return 0;} 阅读全文
posted @ 2011-04-22 19:01 聊聊IT那些事 阅读(312) 评论(0) 推荐(0) 编辑
上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 26 下一页