#53. 枚举算法第一题(NOIP2013)

枚举算法第一题(NOIP2013)

第一题(NOIP2013)

#include<iostream>
#include<string>
using namespace std;
int main() {
    string str;
    cin >> str;
    int n = str.size();
    bool isPalindrome = true;
    for (int i = 0; i < n / 2; i++) {
        if (str[i] != str[n - i - 1]) {
            isPalindrome = false;
        }
    }
    if (isPalindrome)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}
  1. 【判断题】如果去掉第18行,程序不能正常运行。 {{ select(1) }}
  • 正确
  • 错误
  1. 【判断题】如果去掉第8行的初始化,程序可能得不到正确答案。 {{ select(2) }}
  • 正确
  • 错误
  1. 【判断题】在11行下添加一行break;程序运行结果不变。 {{ select(3) }}
  • 正确
  • 错误
  1. 【判断题】如果输入abceecba输出Yes。 {{ select(4) }}
  • 正确
  • 错误
  1. 【选择题】程序的时间复杂度为( )。 {{ select(5) }}
  • O(n)
  • O(logn)
  • O(nlogn)
  • O(n²)
  1. 【选择题】输入abcdefghijklmmmlkjihgfedcba,输出为( )。 {{ select(6) }}
  • No
  • Yes
  • No
  • YES