#10688. 模拟策略第五题(NOIP2011)
模拟策略第五题(NOIP2011)
第五题(NOIP2011)
#include<iostream>
using namespace std;
int main() {
int i,n,m,ans;
cin>>n>>m;
i=n;
ans=0;
while (i<=m) {
ans+=i;
i++;
}
cout<<ans<<endl;
return 0;
}
- 【判断题】删去第7行,运行结果不变。 {{ select(1) }}
- 正确
- 错误
- 【判断题】将第8行的<=改为<,输出减小n。 {{ select(2) }}
- 正确
- 错误
- 【判断题】可以实现一个复杂度为O(1)的代码,效果与上述代码等价。 {{ select(3) }}
- 正确
- 错误
- 【判断题】当m<n时,程序不会运行错误。 {{ select(4) }}
- 正确
- 错误
- 【选择题】输入10 20,输出( )。 {{ select(5) }}
- 5
- 165
- 20
- 10
- 【选择题】时间复杂度为( )。 {{ select(6) }}
- O(max(m-n,0))
- O(n)
- O(n²)
- O(mlogn)