查找存在 2–0–1–9的数位平方和~~~~2024-4-10 00:01
#include <iostream>
#include <cmath>
using namespace std;
typedef long long ll;
int main(){
ll sum=0,po=1;
for(int i=1;i<=40;i++)
{
string x = to_string(i);
for(char it:x)
{
if(it=='2' || it=='0' || it=='1' || it=='9')
{
sum+=i;
po+=pow(i,2);break;
}
}
}
cout<<sum<<" "<<po<<"\n";
return 0;
}