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:
parent
bba95b1588
commit
c2fe814e8a
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user