你加油!!!
by Leap_Frog @ 2019-04-23 21:03:30
@[TerryGong](/space/show?uid=167689)
string啊
by 灵光一闪 @ 2019-04-23 21:09:10
...
有没有用char的写法?
~~(我们老师说尽量先不用STL)~~
by TerryGong @ 2019-04-23 21:13:10
有啊!
by 灵光一闪 @ 2019-04-23 21:13:52
```
char buf[1000];
scanf("%s", buf);
和
string s;
cin>>s;
差不多
```
by 灵光一闪 @ 2019-04-23 21:15:34
@[TerryGong](/space/show?uid=167689)
by 灵光一闪 @ 2019-04-23 21:15:49
@[洛谷亿岁](/space/show?uid=122605)
求指点,我看不出拿错了
~~(一个小学生想哭)~~
by TerryGong @ 2019-04-23 21:16:43
@[洛谷亿岁](/space/show?uid=122605) 我说处理。。。
by TerryGong @ 2019-04-23 21:17:19
@[洛谷亿岁](/space/show?uid=122605)
STL我会用
但是据说考试的时候
容易脑残忘掉用法
所以掌握好char的基础写法
~~([洛谷亿岁](/space/show?uid=122605):你这是什么老师)~~
by TerryGong @ 2019-04-23 21:18:39
那给你一个函数吧:
```
int hd(string s)
{
bool q=false;
//cout<<s<<endl;
for(int i=0;i<s.size();i++)
{
if(s[i]!=0)
{
q=true;
break;
}
}
string t="N";
if(!q) return 0;
t=s;
for(int i=s.size()-1;i>=0;i--)
{
//cout<<1<<endl;
if(t=="0")
{
cout<<0;
return 0;
}
if(t[i]=='0') t=t.substr(0,i);
else
{
cout<<t;
return 0;
}
//cout<<t<<endl;
}
}
```
by 灵光一闪 @ 2019-04-23 21:19:56