04 2011 档案

摘要: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那些事 阅读(269) 评论(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那些事 阅读(505) 评论(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那些事 阅读(316) 评论(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那些事 阅读(562) 评论(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那些事 阅读(421) 评论(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那些事 阅读(321) 评论(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那些事 阅读(1295) 评论(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那些事 阅读(313) 评论(0) 推荐(0) 编辑
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1406需要注意的地方:num1和num2的大小关系不确定。View Code #include"iostream"using namespace std;int v[10000];void Init(){ int i,j; memset(v,0,sizeof(v)); for(i=2; i<10000; i++) { int sum=0; for(j=1;j<=i/2;j++) { if(i%j==0) sum+=j; } if(sum==i) { v[i]=1; } }}in 阅读全文
posted @ 2011-04-22 18:33 聊聊IT那些事 阅读(271) 评论(0) 推荐(0) 编辑
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2054很烦的题~~View Code #include"iostream"#include"string"using namespace std;int i,j,L1,L2;char a[20000],b[20000];int main(){ while(scanf("%s %s",&a,&b)!=EOF) { if(a[0]=='-'&&b[0]=='-'||a[0]!='-& 阅读全文
posted @ 2011-04-22 18:15 聊聊IT那些事 阅读(672) 评论(0) 推荐(0) 编辑
摘要:View Code #include"iostream"#define M 20000#include"algorithm"using namespace std;int c[M];int main(){ int n,m; int a,b; int i,j; while(cin>>n>>m) { int k=0; for(i=0;i<n;i++) { cin>>a; c[k++]=a;} for(i=0;i<m;i++) { cin>>b; c[k++]=b;} sort(c,c+k); for 阅读全文
posted @ 2011-04-22 18:14 聊聊IT那些事 阅读(163) 评论(0) 推荐(0) 编辑
摘要:View Code #include"iostream"using namespace std;int main(){ char ch[1000]; char a[1000][100]; int i,j; int used[1000]; while(gets(ch)) { if(strcmp(ch,"#")==0) break; int L=strlen(ch); int start=0,end=L-1; for(i=0;i<L;i++) if(ch[i]!=' ') {start=i; break;} for(i=L-1;i> 阅读全文
posted @ 2011-04-22 16:57 聊聊IT那些事 阅读(455) 评论(0) 推荐(0) 编辑
摘要:#include"iostream"using namespace std;char s[100];char S[100],E[100];int i=0,j;int used[1000];int sign=0,mark=0;void dfs(int x){ if(E[x]=='m') { cout<<"Yes."<<endl; sign=1; mark=1; } //sign标志已经找到尾“m”,mark表示找到'm'的情况:如果找到则mark=1,否则mark=0; else { for(int 阅读全文
posted @ 2011-04-22 12:17 聊聊IT那些事 阅读(634) 评论(0) 推荐(0) 编辑
摘要:水题一道,注意闰年和平年的判断。View Code #include"iostream"using namespace std;int main(){ int y,m,d; while(scanf("%d/%d/%d",&y,&m,&d)!=EOF) { int sum=0,i; for(i=1;i<m;i++) { switch(i) { case 1: sum+=31; break; case 2: { if(y%4==0&&y%100||y%400==0) { sum+=29; } else sum+= 阅读全文
posted @ 2011-04-21 16:04 聊聊IT那些事 阅读(517) 评论(0) 推荐(0) 编辑
摘要:View Code //Problem 2013 A short problem /*Accept: 158 Submit: 452Time Limit: 1000 mSec Memory Limit : 32768 KB Problem DescriptionThe description of this problem is very short. Now give you a string(length N), and ask you the max sum of the substring which the length can't small than M.InputThe 阅读全文
posted @ 2011-04-21 14:59 聊聊IT那些事 阅读(227) 评论(0) 推荐(0) 编辑
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1290同切西瓜问题一样 阅读全文
posted @ 2011-04-20 18:00 聊聊IT那些事 阅读(270) 评论(0) 推荐(0) 编辑
摘要:摘自:http://blog.sina.com.cn/s/blog_59e67e2c0100a7yx.html需要慢慢注墨。。。。首先引用下leemars的报告:这道题要求N!的最后一个非0数字是多少,如果用一般作法,先统计2和5的个数,然后补乘2,得到的将是TLE。所以还需要再做简化:为了把0去掉,我们把所有的因数2和5都提出来,放到最后再处理。N!中的N个相乘的数可以分成两堆:奇数和偶数。偶数相乘可以写成(2^M)*(M!),M=N DIV 2。M!可以递归处理,因此现在只需讨论奇数相乘。考虑1*3*5*7*9*11*13*15*17* ... *N(如果N为偶数则是N-1),这里面是5的 阅读全文
posted @ 2011-04-20 17:56 聊聊IT那些事 阅读(1092) 评论(0) 推荐(0) 编辑
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1568看了半天,没思路,摘了一位dn的,学习了!View Code 先看对数的性质,loga(b^c)=c*loga(b),loga(b*c)=loga(b)+loga(c);假设给出一个数10234432,那么log10(10234432)=log10(1.0234432*10^7)=log10(1.0234432)+7;log10(1.0234432)就是log10(10234432)的小数部分.log10(1.0234432)=0.01006374410^0.010063744=1.023443198那 阅读全文
posted @ 2011-04-20 17:11 聊聊IT那些事 阅读(368) 评论(0) 推荐(0) 编辑
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2674小技巧 :当数很大时mod2009就为0了。。。。。。。。View Code #include"iostream"using namespace std;int main(){ int n; int i; while(cin>>n) { int mul=1; if(n<=1000) { for(i=1;i<=n;i++) { mul*=i%2009; mul%=2009; } } else mul=0; cout<<mul<<endl; 阅读全文
posted @ 2011-04-20 16:13 聊聊IT那些事 阅读(288) 评论(0) 推荐(0) 编辑
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1071View Code //抛物线 yp=a*(x-b)^2+c;//直线 yz=k*x+s;//二重积分公式: f(x0,x1)(yp-yz)*dx;#include"iostream"usingnamespace std;double a,b,c,k,s;double fun(double x){ return1.0*(a*x*x*x/3)-1.0*(a*b+k/2)*x*x+(a*b*b+c-s)*x;}int main(){ int t; double x1,y1,x2,y2,x 阅读全文
posted @ 2011-04-18 20:38 聊聊IT那些事 阅读(727) 评论(0) 推荐(0) 编辑
摘要:View Code #include"iostream"using namespace std;int prime(int x){ int i; if(x%2==0&&x!=2) return 0; //此处剪枝可以提高效率,要不超时 for(i=3;i<=sqrt(x);i+=2) { if(x%i==0) return 0; } return 1;}int main(){ int n,m; int i; while(cin>>n) { int count=0; for(i=0; i<n; i++) { cin>>m; 阅读全文
posted @ 2011-04-18 16:04 聊聊IT那些事 阅读(377) 评论(0) 推荐(0) 编辑
摘要:算法的力量 2006年5月 算法是计算机科学领域最重要的基石之一,但却受到了国内一些程序员的冷落。许多学生看到一些公司在招聘时要求的编程语言五花八门,就产生了一种误解,认为学计算机就是学各种编程语言,或者认为,学习最新的语言、技术、标准就是最好的铺路方法。其实,大家被这些公司误导了。编程语言虽然该学,但是学习计算机算法和理论更重要,因为计算机语言和开发平台日新月异,但万变不离其宗的是那些算法和理论,例如数据结构、算法、编译原理、计算机体系结构、关系型数据库原理等等。在“开复学生网”上,有位同学生动地把这些基础课程比拟为“内功”,把新的语言、技术、标准比拟为“外功”。整天赶时髦的人最后只懂得招式 阅读全文
posted @ 2011-04-17 20:08 聊聊IT那些事 阅读(427) 评论(1) 推荐(0) 编辑
摘要:求解最大连续子序列和问题,最直接的办法就是求出每个连续子序列的和,然后找出最大和即可,但这种算法的效率为O(n^2),代码如下,int LS(){ int Max=-999999999; for( int i=0;i<n;i++) { int sum=0; for( int j=i;j<n;j++) { sum+=a[j]; if(sum>Max) Max=sum; } } return Max;}这种算法适用于数据量比较小的情况。 在这种方法里, 有许多不必要的重合计算,而正是这些不必要的计算影响了程序的执行效率。为了提高算法的效率,尽可能的排除那些不必要的计算过程,可以采 阅读全文
posted @ 2011-04-14 20:35 聊聊IT那些事 阅读(2851) 评论(0) 推荐(0) 编辑
摘要:View Code #include"iostream"using namespace std;int main(){ int n; int a[10001]; int i; int j=0; while(cin>>n,n) { memset(a,0,sizeof(a)); int start=0,end=0; int k=0; int sum=0,Max=0; int count=0; int L=20000; for(i=0;i<n;i++) { cin>>a[i]; if(a[i]<0) count++; if(a[i]==0&am 阅读全文
posted @ 2011-04-14 18:59 聊聊IT那些事 阅读(433) 评论(0) 推荐(0) 编辑
摘要:数塔问题是典型的dp问题之一,关键点:建立状态转移方程,这也是dp问题常见的一种思考方式(我不知道是不是所有的dp都是这种思考方式,看过的一些资料里面,建立状态转移方程很普遍,可能是自己碰到的面还不够广吧),而这里还有一个更为重要的思考点就是从哪儿开始建立?题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2084 求经过结点数字之和最大值的问题,用二维数组来表示其中结构也是dp里面常用的方法,我觉的用这种方法可能更易于去建立某种关系:非线性—>线性. 因为我觉的dp的思为方式跨度再大,它也的是采用线性关系来让许多看是间断的,不连续的点变成连续 阅读全文
posted @ 2011-04-14 17:04 聊聊IT那些事 阅读(536) 评论(0) 推荐(0) 编辑
摘要:记得刚开始接触dp是数塔问题,那时,感觉dp很深奥,接受不了他的这种跨度比较大的思维方式,因为在这之前,可以说我从来来没有接触过这样的问题, 这种思维方式对我的惯性思维是一个很大的冲击,这也不得不使我重新转换自己的思维习惯,因为在我后来逐渐做dp这类题的时候,有些问题用一般方法是很难解决的,即便用一般方法模拟出来也是tlm。 后来,在对dp逐步的理解和应用过程当中,我感受到了其中的好处,也在慢慢转换着思考方式。一直在学,一直在思考,不同的阶段会遇到不同的问题,有的思考方式很难理解。特别是这种时候,就常常会使我陷入思维困境,可能一小时,一天,有时甚至好几天。到最后实在想不明白,就把问题搁置一边. 阅读全文
posted @ 2011-04-14 16:27 聊聊IT那些事 阅读(237) 评论(0) 推荐(0) 编辑
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2104思路分析:m和n互质即可。与hdu1222相同 http://acm.hdu.edu.cn/showproblem.php?pid=1222 阅读全文
posted @ 2011-04-14 10:00 聊聊IT那些事 阅读(252) 评论(0) 推荐(0) 编辑
摘要:题目链接:http://poj.org/problem?id=1664关于放苹果的那些事。。。。。。。。。。 今天偶然看到一个关于整数划分的算法, 仔细看了后,我想到了放苹果的事,其实这个问题困扰了我很久,一直没想明白放苹果的原理。记得当时做这个题的时候,自己的分析的方法和整数划分的算法是一样的,就是没想到用递归就能做出来,看了一位dn的博客,终于明白是怎么回事了.........例子,整数划分的思想如下:整数划分问题是将一个正整数n拆成一组数连加并等于n的形式,且这组数中的最大加数不大于n。 如6的整数划分为 6 5 + 1 4 + 2, 4 + 1 + 1 3 + 3, 3 + 2 + 1 阅读全文
posted @ 2011-04-13 21:26 聊聊IT那些事 阅读(751) 评论(1) 推荐(0) 编辑
摘要:View Code //**************************************************Description 问题的提出:约19世纪末,在欧州的商店中出售一种智力玩具,在一块铜板上有三根杆(分别使A、B、C),最左边的杆上自上而下、由小到大顺序串着由64个圆盘构成的塔。目的是将最左边杆上的盘全部移到右边的杆上,条件是一次只能移动一个盘,且不允许大盘放在小盘的上面。这是一个著名的问题,几乎所有的教材上都有这个问题。由于条件是一次只能移动一个盘,且不允许大盘放在小盘上面,所以64个盘的移动次数是:18446744073709551615 这是一个天文数字,若每 阅读全文
posted @ 2011-04-13 15:06 聊聊IT那些事 阅读(494) 评论(0) 推荐(0) 编辑
摘要:lcs#include"iostream"using namespace std;int c[1001][1001];int Max(int a, int b){ return a>b?a:b;}void LCS(char aa[], char bb[], int x, int y){ int i,j; for(i=0;i<=x;i++) c[i][0]=0; for(j=0;j<=y;j++) c[0][j]=0; for(i=1;i<=x;i++) { for(j=1;j<=y;j++) { if(aa[i-1]==bb[j-1]) {c[ 阅读全文
posted @ 2011-04-12 18:16 聊聊IT那些事 阅读(257) 评论(2) 推荐(0) 编辑
摘要:View Code #include"iostream"using namespace std;int main(){ int t; int n,a; int i,j=0,k; cin>>t; while(t--) { cin>>n; int sum=0,Max=-99999999; int start=0,end=0; k=0; for(i=0;i<n;i++) { cin>>a; sum+=a; if(sum>Max) { Max=sum; start=k+1; end=i+1; } if(sum<0) { sum= 阅读全文
posted @ 2011-04-12 14:20 聊聊IT那些事 阅读(311) 评论(0) 推荐(0) 编辑
摘要:单词倒置Time Limit:1000MS Memory Limit:65536KTotal Submit:68 Accepted:8 Description 请编制程序实现下面的功能:将一篇英文文章中的以空格或标点符号为分隔的所有单词进行倒排,同时去除标点符号,之后输出已处理的英语文章(应不含标点符号)。Input 有多组数据,每组一行,每组就是一篇小文章。每篇小文章都由大写字母、小写字母、空格及标点符号组成,遇到#时表示输入结束。Output 每组输出其对应的字符串,其单独成行。Sample Input You He MeI am a student.#Sample Output Me H 阅读全文
posted @ 2011-04-11 18:25 聊聊IT那些事 阅读(409) 评论(0) 推荐(0) 编辑
摘要:View Code void get_next(){ int i=-1,j=0; next[0]=-1; while(j<m-1) { if(i==-1||b[i]==b[j]) { ++i; ++j; next[j]=i;} else i=next[i]; }}int Index_KMP(){ int i=0,j=0; while(i<n && j<m) { if(a[i]==b[j]||j==-1) { ++i; ++j;} else j=next[j]; } if(j>=m) return i-m+1; else return -1;}代码:Vie 阅读全文
posted @ 2011-04-08 09:51 聊聊IT那些事 阅读(304) 评论(0) 推荐(0) 编辑
摘要:View Code #include"iostream"using namespace std;int main(){ int n; int a,b,c; int sum; int i,j; cin>>n; while(n--) { cin>>a>>b>>c; if(b>=c) cout<<"Yes"<<endl; else { if(a==0) cout<<"No"<<endl; else if(a>0&&a& 阅读全文
posted @ 2011-04-07 17:31 聊聊IT那些事 阅读(255) 评论(0) 推荐(0) 编辑
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1256View Code #include"iostream"using namespace std;int n,m;int i,j;char a[10];int y; int d; // d表示行的宽度void fun1(){ for( i=0;i<d-y;i++) { if(i<m/6+1) printf(" "); else printf("%s",a); } printf("\n");}void fun2(in 阅读全文
posted @ 2011-04-07 17:07 聊聊IT那些事 阅读(382) 评论(0) 推荐(0) 编辑
摘要:枚举法。。。。View Code #include"iostream"#define M 1000001using namespace std;int a[M];int main(){ int m,n; int i; memset(a,0,sizeof(a)); for(i=1;i<=1000001;i++) { int x=i; int k=i; while(x) { if(x%10==4||x%100==62){ a[k]=1; } x/=10; } } while(cin>>m>>n,m+n) { int flag=0; for(i=m; 阅读全文
posted @ 2011-04-07 16:00 聊聊IT那些事 阅读(280) 评论(0) 推荐(0) 编辑
摘要:产生冠军的条件:(1)获胜的人没输过一次(2)最终获胜的人只有一个View Code #include"iostream"//#include"algorithm"using namespace std;#define M 1010int main(){ int n; int i,j; char a[M][100],b[M][100]; int sum[M],c[M]; while(cin>>n,n) { memset(sum,0,sizeof(sum)); //0表示失败 for(i=0;i<n;i++) { cin>>a 阅读全文
posted @ 2011-04-07 09:34 聊聊IT那些事 阅读(638) 评论(0) 推荐(0) 编辑
摘要:借鉴了一位dn的,筛选法。求出每个数的因子和,然后看因子和是否在1000以内,是的话就证明等于因子和的这个数是不可摸数。http://acm.hdu.edu.cn/showproblem.php?pid=1999 阅读全文
posted @ 2011-04-06 21:13 聊聊IT那些事 阅读(305) 评论(0) 推荐(0) 编辑
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1232基本和1856相同,就是最后需要判断一下。。。。。View Code int count=0;for(i=1;i<=n;i++) //其父结点为其本身即可{ if(FindFa(i)==i) count++;}cout<<count-1<<endl; 阅读全文
posted @ 2011-04-06 15:10 聊聊IT那些事 阅读(219) 评论(0) 推荐(0) 编辑
摘要:View Code #include<iostream>using namespace std;#define M 10000001int father[M];int _max;int sum[M];int FindFa( int a ){if( father[a] == a ){return a;}return father[a] = FindFa( father[a] ); }void UnionFa( int a , int b ) //将a,b合并{father[b] = a; //把a设为b的父结点sum[a] += sum[b]; //当有元素加入a中时,使其个数加su 阅读全文
posted @ 2011-04-06 15:07 聊聊IT那些事 阅读(212) 评论(0) 推荐(0) 编辑
摘要:注意精度进OKl了。。。。。http://acm.hdu.edu.cn/showproblem.php?pid=1036View Code #include"iostream"using namespace std;int main(){ int n; double s; int m; char ch[100]; int i,j,k; cin>>n>>s; while(cin>>m) { int mark=0; int sum=0; for(i=0;i<n;i++) { cin>>ch; if(ch[0]=='- 阅读全文
posted @ 2011-04-04 10:37 聊聊IT那些事 阅读(338) 评论(0) 推荐(0) 编辑
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1408精度问题View Code #include"iostream"using namespace std;int main(){ double v,d; while(cin>>v>>d) { int l=v/d; //l为所滴的滴数 if(l!=v/d) l++; //+1表示最后一滴小于d,也算成一滴 double sum=0; int t=0; //记录间隔数 int i=1; while(sum<l) //已有的滴数和总的滴数比较 { sum+=i; 阅读全文
posted @ 2011-04-04 08:53 聊聊IT那些事 阅读(320) 评论(0) 推荐(0) 编辑
摘要:这类问题一般都有固定的公式,告诉大家一个技巧:二维的一般是f(x)=a*x^2+b*x+c,三维的一般是f(x)=a*x^3+b*x^2+c*x+d. 用带定系数法求出各个系数就行了。http://acm.hdu.edu.cn/showproblem.php?pid=1290View Code #include"iostream"using namespace std;int main(){ int n; while(cin>>n) { cout<<(n*n*n+5*n+6)/6<<endl; } return 0;} 阅读全文
posted @ 2011-04-02 21:18 聊聊IT那些事 阅读(560) 评论(0) 推荐(0) 编辑
摘要:刚开始用了几次gcd(),结果n次tle, 最后用了筛选法,终于a了,效率提高不少啊!http://acm.hdu.edu.cn/showproblem.php?pid=1286View Code #include"iostream"using namespace std;int main(){ int n,a,i,j,count; int b[32768]; cin>>n; while(n--) { cin>>a; memset(b,0,sizeof(b)); for(i=2;i<=a;i++) { if(a%i==0&&b[ 阅读全文
posted @ 2011-04-02 20:51 聊聊IT那些事 阅读(261) 评论(0) 推荐(0) 编辑
摘要::::---> a = b ^ c —-> c = a ^ b b = a ^ c,就是异或递推的关系。http://acm.hdu.edu.cn/showproblem.php?pid=1287View Code // a = b ^ c —-> c = a ^ b b = a ^ c#include"iostream"#include"math.h"using namespace std;int main(){ int n,i; int a[1000]; char ch; while(cin>>n) { for(i=0; 阅读全文
posted @ 2011-04-02 19:45 聊聊IT那些事 阅读(220) 评论(0) 推荐(0) 编辑
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1065错了n次了,让所有的水题汗颜啊!View Code #include"iostream"using namespace std;#define pi 3.1415926//3.1415927(wrong)int main(){ int n; double a,b,sum; cin>>n; int i=0; while(n--) { cin>>a>>b; sum=pi*(a*a+b*b)/2; int x=(int)(sum/50)+1; //(in 阅读全文
posted @ 2011-04-02 17:49 聊聊IT那些事 阅读(387) 评论(0) 推荐(0) 编辑
摘要:m与n互质即可:http://acm.hdu.edu.cn/showproblem.php?pid=1222 阅读全文
posted @ 2011-04-01 21:38 聊聊IT那些事 阅读(206) 评论(0) 推荐(0) 编辑
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2707View Code #include"iostream"#include"math.h"using namespace std;int main(){ char ch[101]; int a[1000]; int b[100]; int i,j; while(1) { int s=0; while(gets(ch)) { if(strcmp(ch,"*")==0) break; if(strcmp(ch,"#")==0) b 阅读全文
posted @ 2011-04-01 20:32 聊聊IT那些事 阅读(285) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示