hdoj acm 1715
来源:互联网 发布:网络电影《成人童话》 编辑:程序博客网 时间:2024/05/17 02:55
#include <iostream>
#include <cstring>
using namespace std;
string add(string a,string b)
{
stringA="0";
A+=a; //必须的
if(a.length()<b.length())
a.swap(b);
for ( inti=1;i<=a.length();i++)
if(i<=b.length())
A[A.length()-i]+=b[b.length()-i]-'0';
for( inti=0;i<A.length();i++)
{
if(A[A.length()-i]>'9')
{
A[A.length()-i]-=10;
A[A.length()-i-1]+=1;
}
}
while(A[0]=='0')
A.erase(0,1);
returnA;
}
string s[1001]={ "0", "1", "1" };
void app ()
{
for(int i=3;i!=1001;++i)
{
s[i]=add(s[i-1],s[i-2]) ;
}
}
int main ()
{
int T;
app();
cin>>T;
while ( T --)
{
int N;
cin >> N;
cout << s[N]<< endl;
}
return0;
}
#include <cstring>
using namespace std;
string add(string a,string b)
{
}
string s[1001]={ "0", "1", "1" };
void app ()
{
}
int main ()
{
}
0 0
- hdoj acm 1008
- hdoj acm 1715
- hdoj acm 1029
- hdoj acm 1003
- hdoj acm 1555
- hdoj acm 1592
- hdoj acm 1097
- hdoj acm 1001
- HDOJ 1984 Mispelling4
-  
- Rightmost Digit hdoj 1061
- HDOJ 1005 Number Sequence
- HDOJ 1722 Cake
- HDOJ 1350 Robot Motion
- HDOJ 1181 变形课
- HDOJ 1013 Digital Roots
- HDOJ 2072 单词数
- HDOJ 2081 手机短号
- 51nod 1107 斜率小于0的连线数量 (树状数组+离线化)
- hdoj acm 1555
- hdoj acm 1592
- hdoj acm 1001
- 安装时防火墙未关闭报错
- hdoj acm 1715
- Identity Card hdoj 2629
- Rightmost Digit hdoj 1061
- package.json依赖管理dependencies中 ^ 和 ~ 的区别
- 关于String比较的一些问题
- hdoj acm 1097
- HDOJ 1004 Let the Balloon Rise
- HDOJ 1051 Wooden Sticks
- HDOJ 1236 排名