PRoblem Link:http://139.129.36.234/problem.php?id=1200
3456样例输出
0.52.02.54.0提示
中南大学计算机&软件复试QQ群552889929
来源
2015年中南大学研究生复试机试题
AC code:
#include<iostream>#include<algorithm>#include<stdio.h>#include<map>#include<math.h>#include<string.h>#include<queue>#include<map>#include<vector>#include<set>#define LL long long#define exp 1e-9#define MAXN 1000010using namespace std;int main(){// freopen("D://in.txt","r",stdin); LL n,x,y; LL ans; while(scanf("%lld",&n)!=EOF) { ans = 0; x = n/4; y = n%4; if(y<2) ans = 4*x*x; else ans = 4*x*(x+1); if(y==1) ans+=2*x-1; else if(y==3) ans+=2*x+1; if(ans&1) printf("%lld.5/n",ans/2); else printf("%lld.0/n",ans/2); } return 0;}
新闻热点
疑难解答