本文共 848 字,大约阅读时间需要 2 分钟。
基本思路同上一题一样,改改上一题的代码就能过了
代码如下:
/*ID: 15674811LANG: C++TASK: dualpal*/#include#include #include #include using namespace std;ofstream fout("dualpal.out");ifstream fin("dualpal.in");char str[100];int check(){ ///回文判断统一模板 int len=strlen(str); for(int i=0;i =10) { str[cnt++]='A'+k-10; } else str[cnt++]='0'+k; } str[cnt]='\0';}int main(){ int n,s; while(fin>>n>>s) { int cnt=1; s++; while(cnt<=n) { int flag=0; for(int i=10;i>=2;i--) { dtoB(s,i); if(check()) flag++; if(flag>=2) break; } if(flag>=2) { cnt++; fout< <
转载地址:http://nkrfb.baihongyu.com/