摘要: 1) #define是预处理指令,在编译预处理时进行简单的替换,不作正确性检查,不关含义是否正确照样带入,只有在编译已被展开的源程序时才会发现可能的错误并报错。例如:#define PI 3.1415926程序中的:area=PI*r*r 会替换为3.1415926*r*r如果你把#define语句中的数字9 写成字母g 预处理也照样带入。2)typedef是在编译时处理的。它在自己的作用域内给一个已经存在的类型一个别名,但是You cannot use the typedef specifier inside a function definition。3)typedef int * int 阅读全文
posted @ 2012-07-11 15:59 xxx0624 阅读(591) 评论(0) 推荐(0) 编辑
摘要: import java.math.BigInteger;import java.util.Scanner;public class Pone{ public static void main(String args[]) { Scanner cin=new Scanner(System.in); //String a1=new String(); int a1=0; String temp=new String(); BigInteger a=BigInteger.valueOf(a1); while(true) { temp=cin.next(); if(temp.eq... 阅读全文
posted @ 2012-07-07 16:18 xxx0624 阅读(215) 评论(0) 推荐(0) 编辑
摘要: 1. 别怕丢人,追求丢人是一种成功的尝试,至于为此笑话你的人,你可以把他们从你将来人生对手的名单中排除了,你也要为每一位上台唱歌的人鼓掌。2、你有足够的理由佩服每天早起的人,不信的话,你去做。做到后会发现有很多人佩服你呢。3、Nothing is impossible。只要选择了目标,不要再想太远,每天脚踏实地,风雨兼程。生命不息,战斗不止。4、你和你的会一起在将来打造一个可能很辉煌的事业。很好听是吗?记住,你们都要努力。5、很多事情当你再回忆时会发现其实没什么。所以,不管当时你多么生气都告诉自己不必这样,你会发现其实真的不必。6、不管别人怎么说大学是个提高综合能力的地方云云,如果你学习失败了 阅读全文
posted @ 2012-05-02 15:05 xxx0624 阅读(169) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include<stdio.h> 2 #include<string.h> 3 int p[10005]; 4 int fmax(int i,int j) 5 { 6 if(i>j) 7 return i; 8 else 9 return j;10 }11 void ff()12 {13 int i,j,sum;14 memset(p,-1,sizeof(p));15 p[1]=1;16 p[2]=2;17 for(i=3;i<=10000;i++)18 {19 ... 阅读全文
posted @ 2012-05-01 18:45 xxx0624 阅读(276) 评论(0) 推荐(0) 编辑
摘要: (先对数字排序,再对字符排序)View Code 1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string.h> 4 struct g{ 5 char name[32]; 6 int sum; 7 }gl[305]; 8 int cmp2( const void *a ,const void *b) 9 { 10 return (*(struct g *)b).sum > (*(struct g *)a).sum ? 1 : -1; 11 }12 int main()13 {14 int i, 阅读全文
posted @ 2012-05-01 18:39 xxx0624 阅读(230) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include<stdio.h> 2 int father[100005],members[100005]; 3 int find(int a) 4 { 5 if(father[a]!=a) 6 father[a]=find(father[a]); 7 return father[a]; 8 }//寻找祖先 9 int main()10 {11 int i,m,n,b,a,num=1;12 char ch;13 while(scanf("%d%d",&n,&m)==2)14 {15 if... 阅读全文
posted @ 2012-05-01 10:23 xxx0624 阅读(308) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include<stdio.h> 2 #include<string.h> 3 __int64 p[1000005]; 4 void ff() 5 { 6 __int64 i,j,sum; 7 memset(p,-1,sizeof(p)); 8 p[1]=1; 9 p[2]=2;10 for(i=3;i<=1000000;i++)11 {12 j=i;13 sum=0;14 while(1){15 if(j%2 == 0)16 ... 阅读全文
posted @ 2012-05-01 00:10 xxx0624 阅读(195) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include<stdio.h> 2 int main() 3 { 4 int m,y,d,sum; 5 scanf("%d%d%d",&y,&m,&d); 6 if((y%4==0&&y%100!=0)||(y%400==0))//闰年 7 { 8 if(m==1) 9 sum=d;10 else11 if(m==2)12 sum=31+d;13 else14 if(... 阅读全文
posted @ 2012-04-29 17:04 xxx0624 阅读(183) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include 2 #include 3 int a[5005]; 4 int sum[5005];//用来记录以a[i]结尾之前的最大上升子序列 5 int main() 6 { 7 int i,j,num=-1,tpmax,t,n,max; 8 scanf("%d",&t); 9 while(t--)10 {11 num++;12 scanf("%d",&n);13 for(i=1;ia[j]&&(tpmaxa[j]用来判断前者比后者大;tpmax<sum[j]是用来判断能否把a[j.. 阅读全文
posted @ 2012-04-28 23:57 xxx0624 阅读(249) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include<stdio.h> 2 int father[100005],members[100005]; 3 int find(int a) 4 { 5 if(father[a]!=a) 6 father[a]=find(father[a]); 7 return father[a]; 8 }//寻找祖先 9 int main()10 {11 int i,m,n,b,a,num=1;12 char ch;13 while(scanf("%d%d",&n,&m)==2)14 {15 if... 阅读全文
posted @ 2012-04-28 23:07 xxx0624 阅读(187) 评论(0) 推荐(0) 编辑