#424. CSP-J模拟套题1-21

CSP-J模拟套题1-21

  1. (阅读程序)
#include <iostream> 
using namespace std; 
int main() 
{ 
    int n, k;
    string s = "";
    const string b = "0123456789ABCDEF";
    cin>>n>>k;
    while (n>0) {
        s = b[n%k] + s;
        n /= k;
    }
    cout<<s<<endl;
    return 0;
}

(判断题)

该程序的时间复杂度为 O(logkn)。( )

{{ select(1) }}

若该程序中输入 k 的值为 18,则输出结果为 n 的 18 进制表示。( )

{{ select(2) }}

(选择题)

输入:

13 2

输出:( )

{{ select(3) }}

  • 1101
  • 1001
  • 1011
  • 1110

输入:

2333 16

输出:( )

{{ select(4) }}

  • 90D
  • 90E
  • 91D
  • 91E