提交时间:2021-05-17 20:59:10

运行 ID: 19617

#include<bits/stdc++.h> using namespace std; string s1[7]={"0123","1234","2345","3456","4567","5678","6789"}; int ans; int compute(string str){ int ans=0; int len=str.length(); for(int i=0;i<len;i++){ ans+=str[i]-'0'; } return ans; } int isPf(int num){ int n=sqrt(num); return n*n==num; } int main(){ for(int i=0;i<=6;i++){ for(int j=0;j<=6;j++){ if(isPf(compute(s1[i]+s1[j]))){ //cout<<s1[i]+s1[j]<<endl; ans++; } } } cout<<ans; return 0; }