摘要:
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那些事
阅读(273)
评论(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那些事
阅读(675)
评论(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那些事
阅读(164)
评论(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那些事
阅读(457)
评论(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那些事
阅读(640)
评论(0)
推荐(0)