0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2025-01-11 16:31:58 +00:00

[Upd] P1206 [USACO1.2]回文平方数 Palindromic Squares

R40787155
This commit is contained in:
Baoshuo Ren 2020-10-29 21:46:17 +08:00 committed by Baoshuo Ren
parent bba95b1588
commit c2fe814e8a
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

View File

@ -30,18 +30,12 @@ class node {
return nums[x];
}
const char* c_str() {
string str() {
string s;
for (int i = len - 1; i >= 0; i--) {
s.push_back(c(nums[i]));
}
return s.c_str();
}
string print() {
for (int i = len - 1; i >= 0; i--) {
cout << c(nums[i]);
}
return "";
return s;
}
bool check() {
for (int i = 0; i < len; i++) {
@ -59,7 +53,7 @@ int main() {
for (int i = 1; i <= 300; i++) {
node t = node(i * i, b);
if (t.check()) {
cout << node(i, b).print() << ' ' << t.print() << endl;
cout << node(i, b).str() << ' ' << t.str() << endl;
}
}
return 0;