__int64 与long long 的区别 杭电 2044

有人进行了总结:http://blog.csdn.net/shiwei408/article/details/7463476
这是编译有警告:

#include<stdio.h>
int main()
{
    long long a[51]={0};
    int n,i;
    scanf("%d",&n);
    a[1] = 1;
    a[2] = 2;
    for(i = 3;i < 51; i++)
        a[i] = a[i-1] + a[i-2];
    while(n--)
    {
        int x1,x2;
        scanf("%d%d",&x1,&x2);
        printf("%lld\n",a[x2-x1]);
    }
    return 0;
}

编译无警告:

#include<stdio.h>
#include<iostream>
using namespace std;
int main()
{
    long long  a[51]={0};
    int n,i;
    scanf("%d",&n);
    a[1] = 1;
    a[2] = 2;
    for(i = 3;i < 51; i++)
        a[i] = a[i-1] + a[i-2];
    while(n--)
    {
        int x1,x2;
        scanf("%d%d",&x1,&x2);
        cout<<a[x2-x1]<<endl;
    }
    return 0;
}

你可能感兴趣的:(杭电)