7 条题解

  • 2
    @ 2023-7-8 15:45:53

    简单而暴力,代码已AC

    #include <bits/stdc++.h>
    using namespace std;
    int a, b;
    int main()
    {
        for (int i = 1000;i <= 9999;i++)
        {
            a = i % 100;
            b = i / 100;
            if ((b + a)*(b + a) == i)
            {
                cout << i << endl;
            }
        }
        return 0;
    }
    
    • 1
      @ 2024-3-1 21:46:40

      输出这个东西就行啦(注意换行):

      2025

      3025

      9801

      花了一小时才硬算出来的,制作不易,点个赞吧

      • 1
        @ 2023-6-24 11:38:42
        for i in range(100,10000):
            if (i % 100 + i // 100) ** 2 == i:
                print(i)
        注:此为Python程序
        
        • 0
          @ 2024-5-9 17:21:36
          #include <bits/stdc++.h>
          using namespace std;
          bool lightning(int x){
          	string g=to_string(x);
          	int z=stoi(g.substr(0,2));
          	int l=stoi(g.substr(2,2));
          	if (pow(z+l,2)==x)return true;
          	return false;
          }
          int main(){
          	for (int i=1000;i<=9999;i++){
          		if (lightning(i))cout<<i<<endl;
          	}
          	return 0;
          }
          
          • 0
            @ 2023-10-5 12:31:08
            #include<bits/stdc++.h>
            using namespace std;
            int main()
            {
                cout << 2025;
                cout << endl << 3025;
                cout << endl << 9801;
                return 0;
            }//A
            
            • 0
              @ 2023-8-5 16:27:26

              已AC:

              #include <bits/stdc++.h>
              using namespace std;
              bool check(int x)
              {
                  int a,b;
                  a=x%10+x/10%10*10;
                  b=x/100%10+x/1000*10;
                  if(pow(a+b,2)==x)
                      return true;
                  return false;
              }
              int main()
              {
                  for(int i=1000;i<=9999;i++)
                  {
                      if(check(i))
                          cout<<i<<endl;
                  }
                  return 0;
              }
              

              也可以直接输出

              2025
              3025
              9801
              
              • 0
                @ 2023-7-7 21:35:30

                #include <iostream> #include <cmath> using namespace std; int main() { int a, b, c, d; for (int i = 1000; i <= 9999; i++) { a = i / 1000; b = i % 1000 / 100; c = i % 1000 % 100 / 10; d = i % 1000 % 100 % 10; if (pow(10 * a + b + 10 * c + d, 2) == 1000 * a + 100 * b + 10 * c + d) { cout << i << endl; } } return 0; }

                • 1

                信息

                ID
                86
                时间
                1000ms
                内存
                32MiB
                难度
                1
                标签
                递交数
                120
                已通过
                84
                上传者