摘要: 1 #include 2 int main() 3 { 4 int n,l,i,j,k,a[1010]; 5 scanf("%d",&k); 6 while(k--) 7 { 8 scanf("%d%d",&l,&n); 9 for(i=0;imax)22 {23 max=sum;24 temp=j+1;25 }26 }27 printf("%d\n",temp);28 }29... 阅读全文
posted @ 2013-07-11 19:46 nylg-haozi 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 int main() 3 { 4 int n,x,ans; 5 while(scanf("%d",&n)!=EOF) 6 { 7 ans = 0; 8 while(n--) 9 {10 scanf("%d",&x);11 ans ^= x;12 }13 printf("%d\n",ans);14 }15 return 0;16 }我们先了解一下位异或的运算法则吧:1、a^b = b^a。2、(a^b... 阅读全文
posted @ 2013-07-11 19:23 nylg-haozi 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 int main() 4 { 5 double k,a,b,v; 6 while(scanf("%lf%lf%lf%lf",&k,&a,&b,&v)!=EOF) 7 { 8 double s1,s2,s3; 9 s1=(k*a-b)/(sqrt(k*k+1));10 s2=sqrt(a*a+b*b);11 s3=sqrt(s2*s2-s1*s1);12 if(a==0&&b==0)13 printf("0.000\n");14... 阅读全文
posted @ 2013-07-11 19:07 nylg-haozi 阅读(151) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #include 4 #include 5 bool cmp(float a,float b) 6 { 7 return a>b; 8 } 9 int main()10 {11 int n,m,i,j,k;12 char a[20],b[1010];13 scanf("%d",&n);14 while(n--)15 {16 fflush(stdin);17 scanf("%s",a);18 scanf("%s",b);19 int l... 阅读全文
posted @ 2013-07-11 16:35 nylg-haozi 阅读(108) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #include 4 #include 5 bool cmp(float a,float b) 6 { 7 return a>b; 8 } 9 int main()10 {11 int n,m,i;12 scanf("%d",&n);13 while(n--)14 {15 float a[610];16 scanf("%d",&m);17 for(i=0;i=20)28 break;29 }30 pri... 阅读全文
posted @ 2013-07-11 16:09 nylg-haozi 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 struct ZH 4 { 5 char name[10010]; 6 int top; 7 }br; 8 int main() 9 {10 int n,len,i;11 char a[10010];12 while(scanf("%d",&n)!=EOF)13 {14 scanf("%s",a);15 len=strlen(a);16 br.top=0;17 for(i=0;i0)22 {23 ... 阅读全文
posted @ 2013-07-11 15:46 nylg-haozi 阅读(156) 评论(0) 推荐(0) 编辑
摘要: 他们的和能被n整除 就输出n 否则输出n-1 1 #include 2 #include 3 int main() 4 { 5 int n; 6 while(scanf("%d",&n)!=EOF) 7 { 8 int i,t,sum=0; 9 for(i=0;i<n;i++)10 {11 scanf("%d",&t);12 sum+=t;13 }14 printf("%d\n",sum%n?n-1:n);15 }16 return 0;17 }比如(1 4 1)之和为6,6/3==2,即他们最终可以变化成(2 阅读全文
posted @ 2013-07-11 15:25 nylg-haozi 阅读(188) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 struct SHIP 4 { 5 char name[15]; 6 char id[10]; 7 }ship[110]; 8 int main() 9 {10 int n,i;11 while(scanf("%d",&n)!=EOF)12 {13 for(i=0;i<n;i++)14 {15 fflush(stdin);16 scanf("%s %s",ship[i].name,ship[i].id);17 ... 阅读全文
posted @ 2013-07-11 15:18 nylg-haozi 阅读(177) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 int main() 7 { 8 int n,i,m; 9 scanf("%d",&n);10 while(n--)11 {12 scanf("%d",&m);13 int x[21],y[21];14 for(i=0;i<m;i++)15 scanf("%d%d",&x[i],&y[i]);16 sort(x,x+m);17 ... 阅读全文
posted @ 2013-07-11 10:43 nylg-haozi 阅读(133) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 int c,i,d,e[300]={1,1}; 7 int main() 8 { 9 for(i=2;i0)24 {25 if((n&1)==1)// 当前位是126 ++c;// 计数器加127 else28 ++d;29 n>>=1; // 移位30 }31 } 阅读全文
posted @ 2013-07-11 10:14 nylg-haozi 阅读(120) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 int a[100010]; 7 int main() 8 { 9 int n,m,b,i,c;10 while(scanf("%d%d",&n,&m)!=EOF)11 {12 memset(a,0,sizeof(a));13 for(i=0;i<n;i++)14 {15 scanf("%d",&c);16 a[c]=1;17 ... 阅读全文
posted @ 2013-07-11 09:52 nylg-haozi 阅读(90) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 bool cmp(int a,int b) 7 { 8 return a>b; 9 }10 int main()11 {12 int record1(int n);13 int n,m;14 while(scanf("%d%d",&n,&m),n||m)15 {16 if(n>m)17 {18 int t=n;n=m;m=t;19 }20 ... 阅读全文
posted @ 2013-07-11 09:36 nylg-haozi 阅读(168) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 bool cmp(int a,int b) 7 { 8 return a>b; 9 }10 int main()11 {12 int record1(int n);13 int n;14 while(scanf("%d",&n)!=EOF)15 {16 printf("%d\n",record1(n));17 }18 return 0;19 }20 int record1(int n)... 阅读全文
posted @ 2013-07-11 09:20 nylg-haozi 阅读(293) 评论(0) 推荐(0) 编辑