记录编号 122466 评测结果 AAAAAAAAAA
题目名称 [SDOI 2007] 兔子 最终得分 100
用户昵称 GravatarHouJikan 是否通过 通过
代码语言 C++ 运行时间 0.008 s
提交时间 2014-09-23 20:06:03 内存使用 0.36 MiB
显示代码纯文本
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <set>
#include <list>
#include <iterator>
#include <ctime>
#include <queue>
#include <stack>
#include <vector>
#include <functional>
#include <deque>
#define For(i,j,k) for(int i=(j);i<=(k);i++)
using namespace std;
typedef long long LL;
typedef unsigned int Uint;
const int INF=0x7fffffff;
const double eps=1e-6;
using namespace std;
//================struct declaration======================
struct bign
{
  int num[200];
  int len;
  bign ()
  {
    memset(this->num,0,sizeof(this->num));
    len=1;
  }
  bign (int x)
  {
    len=0;
    while (x!=0)
    {
      num[++len]=x%10000;
      x/=10000;
    }
  }
  bign operator +(const bign &rhs) const
  {
     bign res;
     int len=max(this->len,rhs.len);
     res.len=len;
     For(i,1,len)
       res.num[i]=num[i]+rhs.num[i];
     For(i,1,len)
       if (res.num[i]>=10000)
       {
         res.num[i+1]+=res.num[i]/10000;
         res.num[i]%=10000;
       }
     if (res.num[len+1]!=0)
       res.len++;
     return res;
  }
  void print()
  {
    printf("%d",num[len]);
    for(int i=len-1;i>0;i--)
      printf("%04d",num[i]);
  }
};
//================var declaration=-========================
const int MAXN=110;
bign f[MAXN];
int m,d;
//================function declaration====================

//================main code===============================
int main()
{
  string ProgrammeName="rabbit";
  string FloderName="COGS";
  freopen((ProgrammeName+".in").c_str(),"r",stdin);
  freopen((ProgrammeName+".out").c_str(),"w",stdout);
#ifdef DEBUG
  clock_t Start_Time=clock();
   system(("cp C:\\Users\\Administrator\\Desktop\\"+FloderName+"\\standard.cpp C:\\Users\\Administrator\\Desktop\\"+FloderName+"\\submit.txt").c_str());
#endif
  scanf("%d%d",&m,&d);
  For(i,1,m)
    f[i]=f[i-1]+1;
  For(i,m+1,d+1)
    f[i]=f[i-1]+f[i-m];
  f[d+1].print();
#ifdef DEBUG
  clock_t End_Time=clock();
  printf("\n\nTime Used :%.6lf Ms\n",double(Start_Time-End_Time)/(-CLOCKS_PER_SEC));
#endif
  return 0;
}
//================function code===========================