#10742. 数论第一题(NOIP2012)

数论第一题(NOIP2012)

第一题(NOIP2012)

#include<iostream>
using namespace std;
int n,i,ans;
int main(){
    cin>>n;
    ans=0;
    for(i=1;i<=n;i++)
        if(n%i==0) ans++;
    cout<<ans<<endl;
}
  1. 【判断题】该程序可能输出负数。
    {{ select(1) }}
  • 正确
  • 错误
  1. 【判断题】可以将第7行的i初始值赋为0。
    {{ select(2) }}
  • 正确
  • 错误
  1. 【判断题】输入18,输出结果为6。
    {{ select(3) }}
  • 正确
  • 错误
  1. 【判断题】该程序可以正常运行。
    {{ select(4) }}
  • 正确
  • 错误
  1. 【选择题】如果将第8行的ans++改成ans--,那么输入18,输出结果为( )。
    {{ select(5) }}
  • 6
  • -6
  • man
  • ans
  1. 【选择题】该算法的时间复杂度为( )。
    {{ select(6) }}
  • O(n)
  • O(1)
  • O(n²)
  • O(nlogn)