求助!!!是luogu不资瓷这种方法吗???

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

@[___new2zy___](/space/show?uid=60359) 试一下luogu IDE
by lahlah @ 2018-09-03 17:11:40


@[lahlah](/space/show?uid=31656) 试了啊。。。仍然RE
by ___new2zy___ @ 2018-09-03 17:15:37


@[___new2zy___](/space/show?uid=60359) 用IDE,把你的函数一个个试一遍确定哪个挂了再说
by chengni @ 2018-09-03 17:26:53


感谢巨佬们的帮助 @[lahlah](/space/show?uid=31656) @[chengni](/space/show?uid=60136) 经测试,将上面代码中的turn函数去掉直接转化为下面这样,就没事了 ```cpp inline void print(int x)//输出base进制下的数x { int A[23],len=0;//将原本的turn函数嵌入到下面 while(x) { A[++len]=x%base; x/=base; } for(int i=len;i>=1;i--) printf("%c",turn_char(A[i])); } ``` 可能是我原本的turn函数传参有问题吧,具体我也不清楚。。 总之现在好了就对了 (我要去厚颜无耻地发题解了) (逃 再次谢谢巨佬们啦~~~ 至此,此贴已坟,勿回
by ___new2zy___ @ 2018-09-03 17:34:34


~~直接getchar多好~~
by Karlis @ 2018-09-03 17:36:16


%%%
by 言者 @ 2018-09-03 17:53:11


%%%
by _ztyqwq @ 2018-09-03 19:31:42


``` #include<bits/stdc++.h> using namespace std; int b; char c[10001]; int t; const char g[]={"ABCDEFGHIJ"}; bool check(void) { int i; for(i=1;i<=t/2;i++) { if(c[i]!=c[t-i+1]) return false; } return true; } void turn(int n) { while(n) { t++; if(n%b>=10) c[t]=g[n%b-10]; else c[t]=n%b+'0'; n/=b; } } int main() { int i,j; cin>>b; for(i=1;i<=300;i++) { turn(i*i); if(check()) { cout<<i<<" "; for(j=t;j>=1;j--) { cout<<c[j]; } cout<<endl; } } return 0; } ``` 为何错了????
by 开心果i @ 2018-09-08 13:01:38


20进制 少一个字母 ABCDEFGHIJK=10~20
by Herbert28 @ 2020-02-03 19:49:12


|