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;
}
}
#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;
}
}
相关文章推荐
- HDU 4627 The Unsolvable Problem 杭电多校联赛第三场1009 数学题
- hdu 4627 The Unsolvable Problem【hdu2013多校3签到】
- hdu 4627 The Unsolvable Problem(暴力)
- HDU-4627 The Unsolvable Problem 简单数学
- hdu 4627 The Unsolvable Problem(暴力的搜索)
- HDU-4627-The Unsolvable Problem
- hdu 4627 The Unsolvable Problem【hdu2013多校3签到】
- HDU 4627 The Unsolvable Problem 2013 Multi-University Training Contest 3
- 2013多校联合3 G The Unsolvable Problem(hdu 4627)
- hdu 4627 The Unsolvable Problem
- HDU 4627 There are many unsolvable problem in the world.It could be about one or about zero.But this time it is about bigger number.
- 2013多校联合3 G The Unsolvable Problem(hdu 4627)
- hdu - 4627 - The Unsolvable Problem
- hdu 4627 The Unsolvable Problem
- HDU 4627 The Unsolvable Problem
- hdu 4627 The Unsolvable Problem
- HDU 4691 The Unsolvable Problem 后缀数组
- hdu 4627 The Unsolvable Problem
- 多校第三场 1006 hdu 5323 Solve this interesting problem(dfs)
- HDOJ 4627 - The Unsolvable Problem 打表观察..