斐波那契数列
#include <iostream>
using namespace std;
int main()
{
int month;
while(cin >> month)
{
int sum = 1;
int front = 1;
int back = 1;
while(month > 2)
{
sum = front + back;
front = back;
back = sum;
month--;
}
cout << sum << endl;
}
return 0;
}
#include <iostream>
#include <string>
using namespace std;
bool Mate(const char* A, const char* B)
{
if (*A == '\0' && *B == '\0')
return true;
if (*A == '\0' || *B == '\0')
return false;
if (*A == '?')
return Mate(A + 1, B + 1);
else if (*A == '*')
return Mate(A + 1,B) || Mate(A,B + 1) || Mate(A + 1, B + 1);
else if (*A == *B)
return Mate(A + 1,B + 1);
return false;
}
int main()
{
string str1,str2;
while(cin >> str1 >> str2)
{
if (Mate(str1.c_str(), str2.c_str()))
cout << "true" << endl;
else
cout << "false" << endl;
}
return 0;
}