摘要:
如果一个正整数n至少在两个不同的进位制b1和b2下都是回文数(2using namespace std;bool huiwen(int n){ int total=0; for(int base=2;basei/2)total++; if(total>=2)return true; } return false;}int main(){ int s; while(scanf("%d",&s)==1) { for(s=s+1;;s++) { if(huiwen(s)) { cout<<s<<endl;break;}//不可以不加大括号,那
阅读全文
posted @ 2013-07-11 16:08
Forgiving
阅读(257)
推荐(0)
编辑
posted @ 2013-07-11 15:55
Forgiving
阅读(196)
推荐(0)
编辑
posted @ 2013-07-11 15:48
Forgiving
阅读(202)
推荐(0)
编辑
posted @ 2013-07-11 15:45
Forgiving
阅读(124)
推荐(0)
编辑
摘要:
拓扑序列 C++核心代码bool TopologicalSort(int a[][101]) //可以完成拓扑排序则返回True{int n = a[0][0], i, j;int into[101], ans[101];memset(into, 0, sizeof(into));memset(ans, 0, sizeof(ans));for (i = 1; i 0)into[j]++;}}into[0] = 1;for (i = 1; i n)return false;}ans[i] = j;into[j] = -1;for (int k = 1; k 0)into[k]--;}}fo...
阅读全文
posted @ 2013-07-11 15:04
Forgiving
阅读(141)
推荐(0)
编辑