题目链接
/*
对于gcd(a,b)=ax+by,存在唯一的x和y使等式成立
*/
#include
int gcd(int a,int b)
{
return b==0?a:gcd(b,a%b);
}
int main()
{
int s,p;
int a,b,n;
scanf("%d",&s);
while(s--)
{
scanf(...
分类:
其他好文 时间:
2015-02-17 14:10:40
阅读次数:
163
题目链接
#include
int main()
{
int T,N,K;
scanf("%d",&T);
while(T--)
{
scanf("%d%d",&N,&K);
if(N%K==0)
printf("%d\n",N/K);
else
printf("%d\n",N/K+1);
}
return 0;
}...
分类:
其他好文 时间:
2015-02-16 22:14:31
阅读次数:
162
链接:click here
题目:有一个牧场,牧场上有很多个供水装置,现在牧场的主人想要用篱笆把这些供水装置圈起来,以防止不是自己的牲畜来喝水,各个水池都标有各自的坐标,现在要你写一个程序利用最短的篱笆将这些供水装置圈起来!(篱笆足够多,并且长度可变)
输出各个篱笆经过各个供水装置的坐标点,并且按照x轴坐标值从小到大输出,如果x轴坐标值相同,再安照y轴坐标值从小到大输出
样例输入...
分类:
其他好文 时间:
2015-02-16 22:11:37
阅读次数:
228
题目链接
#include
#include
struct point
{
double x;
double y;
}circle,a,b,c,d;
double r;
double dis(point &a,point &b)
{
return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}
in...
分类:
其他好文 时间:
2015-02-16 18:25:25
阅读次数:
152
题目链接
#include
int main()
{
int i,s,k,x;
scanf("%d",&s);
while(s--)
{
scanf("%d",&k);
for(i=k+1;i<=2*k;i++)
{
x=(k*i)/(i-k);
if(k == i*x/(x+i))
printf("1/%d=1/%d+1/%d\n",k...
分类:
其他好文 时间:
2015-02-16 10:19:24
阅读次数:
150
题目链接
#include
int main()
{
int n;
while(~scanf("%d",&n))
{
if(n>=7)
printf("3 5 7\n");
else
printf("No triple\n");
}
return 0;
}...
分类:
其他好文 时间:
2015-02-16 10:18:28
阅读次数:
172
一维问题:nyoj 44 子串和
链接:click here
题目大意:给定一整型数列{a1,a2...,an},找出连续非空子串{ax,ax+1,...,ay},使得该子序列的和最大,其中,1
思路:m是元素总个数,sum是第一个元素,将当前的第一个元素作为最大值max,之后依次输入,检查sum
代码:
#include
#include
#include
#includ...
分类:
其他好文 时间:
2015-02-15 23:12:25
阅读次数:
185
题目链接
#include
#include
using namespace std;
int a[1100];
int main()
{
int i,n,min,temp;
while(~scanf("%d",&n))
{
min=10000000;
for(i=0;i<n;i++)
scanf("%d",&a[i]);
sort(...
分类:
其他好文 时间:
2015-02-15 18:11:19
阅读次数:
135
NYOJ 280 LK的项链 :click here
POJ 2409 Let it Bead:click here
题意:一盒有红、蓝、绿三种颜色的珠子,每种颜色珠子的个数都大于24,现在LK想用这一盒珠子穿出一条项链,项链上的珠子个数为n(0
poj 上是c种颜色,s个珠子组成,数据比24小。
思路:今天刚接触到polya 定理:
Polya定理:设...
分类:
其他好文 时间:
2015-02-15 10:45:22
阅读次数:
172
http://acm.nyist.net/JudgeOnline/problem.php?pid=590
#include
int a[1010];
int main()
{
int n,m,i,j,sum,temp;
while(~scanf("%d%d",&n,&m))
{
sum=0;
for(i=0;i<n;i++)
scanf("%d",&a[i]);
...
分类:
其他好文 时间:
2015-02-15 09:29:19
阅读次数:
192