評分結果(參考) : AC (27ms, 6MB)
#include<bits/stdc++.h>
#define int long long
using namespace std;
string getKey(int num){
string key(10, '0');
while(num != 0){
key[num%10]++;
num /= 10;
}
return key;
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
unordered_map<string, string> mp;
mp.reserve(100000);
for(int i = 30; i <= 99999; i++){
mp[getKey(i*i)] += to_string(i*i) + ' ';
}
int num;
while(cin >> num){
string k = getKey(num);
if(mp.count(k)) cout << mp[k] << '\n';
else cout << "0\n";
}
}