摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1259按题目意思,依次交换即可,本来想用个标记变量记录J的位置以提高运行速度的,后来暴力代码交上去后发现0MS,想想就算了#include<stdio.h>#include<string.h>int main(){ int x,y,n,m,i; char s[10],temp; scanf("%d",&n); while(n--) { strcpy(s,"ZJUTACM"); scanf("%d",&m); w 阅读全文
posted @ 2013-05-14 20:09 执着追求的IT小小鸟 阅读(122) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1222题目说的是狼按规则找兔子,然后吃掉的意思,问是否存在狼找不到的洞,只要判断两个数是否互质就可以了,写代码时有点蒙~~~其实直接用辗转相除法外加递归就可以了#include<stdio.h>int prime(int n,int m){ int i; if(n<m) { i=n; n=m; m=i; } for(i=2;i<=m;i++) if(n%i==0&&m%i==0) return 1; return 0;}... 阅读全文
posted @ 2013-05-14 19:53 执着追求的IT小小鸟 阅读(139) 评论(0) 推荐(0) 编辑