aaaa___ @ 2018-10-07 16:24:47
#include <iostream>
using namespace std;
int main() {
int t[256];
string s;
int i;
cin >> s;
for (i = 0; i < 256; i++)
t[i] = 0;
for (i = 0; i < s.length(); i++)
t[s[i]]++;//这里是啥意思啊
for (i = 0; i < s.length(); i++)
if (t[s[i]] == 1) {
cout << s[i] << endl;
return 0;
}
cout << "no" << endl;
by aaaa___ @ 2018-10-07 16:25:18
t[s[i]]是什么 数组嵌套?
by Ureka_Gestalt @ 2018-10-07 16:28:01
就是把s[i]
的值作为要访问的t
数组的下标QWQ 蒟蒻不懂嵌套
by 苏钦云 @ 2018-10-07 16:28:10
@列王纷争
就是把s[i]的值作为t数组的下标,很好理解。
by Imakf @ 2018-10-07 16:28:19
为什么我在主页看到以为是空白tie????
by 苏钦云 @ 2018-10-07 16:28:30
嗯?
by 镉八君 @ 2018-10-07 16:31:51
@Imakf 我也是,,,,开了F12才进来的
by aaaa___ @ 2018-10-07 16:34:57
@CYY_Gestalt 那S[I]的值是啥·-·
by aaaa___ @ 2018-10-07 16:35:19
@苏钦云 S[I]的值是啥·-·S不是字符串吗
by Waddles @ 2018-10-07 16:43:16
我也是
by 苏钦云 @ 2018-10-07 16:44:29
@列王纷争
字符串就是一个操作方便一些的char数组啊