美文网首页
7744问题

7744问题

作者: EastwardFlow | 来源:发表于2018-10-23 21:32 被阅读0次
输出型如aabb的4位完全平方数(既前两位数字相等,后两位数字也相等)
#include <iostream>
using namespace std;
int main(int argc, char const *argv[])
{
    int n = 0;
    for (int a = 0;;a++){
        int t = a*a;
        if (t>9999) break;
        if (t<1000) continue;
        int t1 = t/100;
        int t2 = t%100;
        if (t / 10 == t % 10 && t2 / 10 == t2 % 10)
        {
        cout<<t<<endl;           
        }
        n++;
    }
    cout<<n<<endl;
    return 0;
}
}

相关文章

网友评论

      本文标题:7744问题

      本文链接:https://www.haomeiwen.com/subject/dklzzftx.html