首页 > 其他 > 详细

CodeForces 592B The Monster and the Squirrel

时间:2016-05-07 22:09:39      阅读:238      评论:0      收藏:0      [点我收藏+]

规律题,多画几个就能找到规律了。

#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;

long long a[60000];
long long C;

int main()
{
    a[3]=1; C=3;
    for(int i=4;i<=54321;i++)
    {
        a[i]=a[i-1]+C;
        C=C+2;
    }

    int n;
    while(~scanf("%d",&n))
    printf("%lld\n",a[n]);
    return 0;
}

 

CodeForces 592B The Monster and the Squirrel

原文:http://www.cnblogs.com/zufezzt/p/5469172.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!