摘要:
/*清除缓存cin.sync();*/#include <iostream>using namespace std;int main () { char first, second; cout << "Please, enter a word: "; first=cin.get(); cin.sync(); cout << "Please, enter another word: "; second=cin.get(); cout << "The first word began by " 阅读全文
摘要:
/*给出n个位置,每个位置可以填充0和1,但有条件限制:1不能相邻。求满足条件的序列的所有可能情况。*/#include<iostream>using namespace std;__int64 a[47][2];int main(){ int T,n,i,s; a[1][0]=1;a[1][1]=1; /*按上面的递推公式求出n从1到46的结果存储在数组a[47][2]中。*/ for(i=2;i<=46;i++) { a[i][0] = a[i-1][0]+a[i-1][1]; a[i][1]=a[i-1][0]; } ... 阅读全文