#441. CSP-J模拟套题2-13
CSP-J模拟套题2-13
- (单选题)对于以下程序,说法正确的是( )。
#include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin>>s;
for(int i=0;i<s.size()-5;i++){
cout<<s[i];
}
}
{{ select(1) }}
- 因为 s.size() 的时间复杂度为 O(n),所以该程序的时间复杂度为 O(n2)
- 如果输入字符串是 abc,那么该程序运行时会产生段错误
- 如果输入字符串是 abc,那么该程序会死循环
- 如果读入 “hello world”,那么程序会输出 hello
相关
在下列比赛中: