您的位置:首页 > 其它

hdu 4627 The Unsolvable Problem 多校第三场

2013-07-30 18:03 351 查看
唉,我是只能A水题的渣渣啊。。

#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstdio>
#include <vector>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
using namespace std;

typedef __int64 lld;
const int MAXN = 10010;
int gcd(int a,int b)
{
return b==0?a:gcd(b,a%b);
}
int main()
{
int T;
scanf("%d",&T);
while(T--)
{
int n;
scanf("%d",&n);
lld ans;
for(int i=n/2;i>=1;i--)
{
if(gcd(n-i,i)==1)
{
ans=(lld)(n-i)*(lld)(i);
break;
}
}
cout<<ans<<endl;
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: