码迷,mamicode.com
首页 >  
搜索关键字:nyoj 663 弟弟的作业    ( 1829个结果
NYOJ-63 小猴子下落(二叉树及优化算法详解)
小猴子下落时间限制:3000ms | 内存限制:65535KB难度:3描述有一颗二叉树,最大深度为D,且所有叶子的深度都相同。所有结点从左到右从上到下的编号为1,2,3,·····,2的D次方减1。在结点1处放一个小猴子,它会往下跑。每个内结点上都有一个开关,初始全部关闭,当每次有小猴子跑到一个开关...
分类:编程语言   时间:2015-02-18 12:58:45    阅读次数:801
NYOJ 972 核桃的数量【最小公倍数】
还要考虑0这个特殊的条件,比较坑   题目链接     #include int gcd(int a,int b) { return b==0?a:gcd(b,a%b); } int main() { int a,b,c,n,m; while(~scanf("%d%d%d",&a,&b,&c)) { if(a&&b&&c) { n=a/gcd...
分类:其他好文   时间:2015-02-17 22:27:46    阅读次数:151
NYOJ 144 小珂的苦恼【扩展gcd】
题目链接 /* 对于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
NYOJ 1082 买新书了【简单题】
题目链接   #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
NYOJ 78 圈水池( 凸包入门)
链接:click here 题目:有一个牧场,牧场上有很多个供水装置,现在牧场的主人想要用篱笆把这些供水装置圈起来,以防止不是自己的牲畜来喝水,各个水池都标有各自的坐标,现在要你写一个程序利用最短的篱笆将这些供水装置圈起来!(篱笆足够多,并且长度可变) 输出各个篱笆经过各个供水装置的坐标点,并且按照x轴坐标值从小到大输出,如果x轴坐标值相同,再安照y轴坐标值从小到大输出 样例输入...
分类:其他好文   时间:2015-02-16 22:11:37    阅读次数:228
NYOJ 1165 just a problem【计算几何】
题目链接 #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
NYOJ 66 分数拆分【数学题】
题目链接 #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
NYOJ 1156 素数三元组【尝试题】
题目链接 #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
NYOJ 615 最近点对【简单题】
题目链接   #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
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!