求助,不懂啊哪错了

P1628 合并序列

@[telankesi](/user/866969) ``` scanf(" %s", &m);``` string 不能这么读入。
by hanjinghao @ 2023-03-12 21:28:06


@[telankesi](/user/866969) 如果要用 scanf 可以这样: ```cpp #include <bits/stdc++.h> using namespace std; string s; int main() { s.resize(105); scanf("%s", &s[0]); printf("%s\n", s.c_str()); printf("%s\n", &s[0]); return 0; } ```
by hanjinghao @ 2023-03-12 21:28:51


@[telankesi](/user/866969) 或者直接用 cin。
by hanjinghao @ 2023-03-12 21:29:19


@[telankesi](/user/866969) @[hanjinghao](/user/187034) cin太慢了()还是关流吧 ```cpp ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); ``` * *注:此方法不适用于强制在线,没有缓冲区的输入输出是离线的*
by ReturnOrContinue @ 2023-08-26 06:26:51


|