• 个人简介

    1.判断质数

    bool prime(int n){
        if (n <= 1) return false;
        if (n == 2) return true;
        if (n % 2 == 0) return false;
        for (int i = 3; i <= sqrt(n); i += 2) {
            if (n % i == 0) return false;
        }
        return true;
    }
    

    2.判断回文数

    bool palindrome(int n){
        std::string s = std::to_string(n);
        int l=0;
        int r=s.length()-1;
        while (l<r){
            if (s[l]!=s[r]) return false;
            l++;
            r--;
        }
        return true;
    }
    
  • 通过的题目

  • 最近活动

    This person is lazy and didn't join any contests or homework.
  • 最近编写的题解

    This person is lazy and didn't write any solutions.

题目标签

客观题
1