From c2fe814e8a987ce6281f3f7541b7fb9f38449984 Mon Sep 17 00:00:00 2001 From: Ren Baoshuo Date: Thu, 29 Oct 2020 21:46:17 +0800 Subject: [PATCH] =?UTF-8?q?[Upd]=20P1206=20[USACO1.2]=E5=9B=9E=E6=96=87?= =?UTF-8?q?=E5=B9=B3=E6=96=B9=E6=95=B0=20Palindromic=20Squares?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit R40787155 --- problem/P1206/P1206.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/problem/P1206/P1206.cpp b/problem/P1206/P1206.cpp index 12daf4c1..4a0e060e 100644 --- a/problem/P1206/P1206.cpp +++ b/problem/P1206/P1206.cpp @@ -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;