错题总结08.14

今天不上课只刷题,感觉好棒

1.strlen(a)可用来计算字符长度;

。。。我收回原来的话。。

 

#include<bits/stdc++.h>
using namespace std;
char l,ch[100002],a[27],b='a',c[26],temp; 
int main()
{
 a[0]='a';
 for(int i=1;i<26;i++)
 a[i]=b++;
 int n,m[26]={0},x,y=0,k=0,tenp;
 gets(ch);
 l=strlen(ch);
 for(int i=0;i<l;i++)
 {
  x=i;
  for(int j=0;j<26;j++)
  if(ch[x]==a[j])
  {
  m[j]++;
  c[j]=ch[x];
     if(m[j]==1)
  {
  tenp=m[j],j=k,m[j]=tenp;
     temp=c[j],j=k,c[j]=temp;
}
k=0;
 }
 else k++;
 }
 for(int i=0;i<26;i++)
 {
 if(m[i]==1)
 {
  cout<<c[i];break;
 }
 else y++;
 if(y==25) cout<<"no"<<endl;
}
 return 0;
}

 

这道题我弄了将近四十分钟,到现在还没弄出来正确答案,放到这留个纪念。。。下次回来继续搞。

posted @ 2017-08-14 21:13  礿尧  阅读(93)  评论(0)    收藏  举报