摘要: #include<iostream>#defineN100usingnamespacestd;intmain(){intcount,total;cin>>total;inta[N];for(count=0;count<total;count++)cin>>a[count];for(count=total-1;count>=0;count--)cout<<a[count]<<"";return0;} 阅读全文
posted @ 2012-04-16 19:22 逝者*恋世 阅读(141) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h>#include<string.h>#include<iostream>using namespace std;#define N 110char str1[N],str2[N];int a[N],b[N],c[N];int main(){ int n,i,j; int len1,len2; cin>>n; while(n--) { memset(a,0,sizeof(a)); memset(b,0,sizeof(b)); memset(c,0,sizeof(c)); cin>>str1>> 阅读全文
posted @ 2012-04-16 19:12 逝者*恋世 阅读(444) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>using namespace std;int common(int x,int y){ if (x==y) return x; if (x>y) return common(x/2,y); else return common(x,y/2);}int main(){ int x,y; cin>>x>>y; cout<<common(x,y)<<endl; return 0;} 阅读全文
posted @ 2012-04-11 20:24 逝者*恋世 阅读(112) 评论(0) 推荐(0) 编辑
摘要: #include<iostream>using namespace std;int main(){int arr[100],i,x=0,y=0,z=0,n;cin>>n;for(i=0;i<n;i++)cin>>arr[i];for(i=0;i<n;i++){if(arr[i]==1)x++;else if(arr[i]==5)y++;else if(arr[i]==10)z++;}cout<<x<<endl;cout<<y<<endl;cout<<z<<endl;retur 阅读全文
posted @ 2012-04-11 19:34 逝者*恋世 阅读(107) 评论(0) 推荐(0) 编辑
摘要: #include<iostream>usingnamespacestd;intmain(){intL,i,j,n;booltrees[10001];for(i=0;i<10001;i++)trees[i]=true;cin>>L>>n;for(i=0;i<n;i++){intbegin,end;cin>>begin>>end;for(j=begin;j<=end;j++)trees[j]=false;}intcount=0;for(i=0;i<=L;i++)if(trees[i])count++;cout< 阅读全文
posted @ 2012-04-09 20:14 逝者*恋世 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 利用归并求逆序对DescriptionIn this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers by swapping two adjacent sequence elements until the sequence is sorted in ascending order. For the input sequence9 1 0 5 4 ,Ultra-QuickSort produces the 阅读全文
posted @ 2012-04-09 19:36 逝者*恋世 阅读(225) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>using namespace std;int jz(int n,int y){if(n/8==0) return (n+y);elsey=y+n/8*10;y=jz(n%8,y);return y;}int main(){int x,y;cin>>x;y=jz(x,0);cout<<y<<endl;return 0;} 阅读全文
posted @ 2012-04-09 19:14 逝者*恋世 阅读(152) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>#include <cstdio>#include <cstring>using namespace std;const int N=10;char a[N];int main(){int t;scanf("%d",&t);while(t--){int z=0;scanf("%s",a);int len=strlen(a);for(int i=0;i<len;i++){z*=16;if(a[i]>='A')z+=a[i]-'A'+ 阅读全文
posted @ 2012-04-08 19:49 逝者*恋世 阅读(142) 评论(0) 推荐(0) 编辑
摘要: #include<iostream>#defineN100usingnamespacestd;structInfo{ charname[80]; intlasttest; intdiscuss; charmana; charwest; inttext; intsum;};intmain(){ Infoa[N];intmax,i;cin>>max;for(i=0;i<max;i++){ cin>>a[i].name;cin>>a[i].lasttest;cin>>a[i].discuss;cin>>a[i].mana; 阅读全文
posted @ 2012-04-08 13:27 逝者*恋世 阅读(142) 评论(0) 推荐(0) 编辑
摘要: 1.#include<iostream>2.usingnamespacestd;3.intmain()4.{5. intn;6. cin>>n;7. inti,j,sum=0;8. for(i=1;i<=n;i++)9. if(i%7!=0&&i/10!=7&&i%10!=7)10. sum+=i*i;11.cout<<sum<<endl;12.return0;13.} 阅读全文
posted @ 2012-04-08 13:24 逝者*恋世 阅读(166) 评论(0) 推荐(0) 编辑