Shirlies
宁静专注认真的程序媛~
摘要: #include <iostream>using namespace std;int get_count(int a){int count=1;while(a!=1){if(a%2)a=3*a+1;elsea=a/2;count++;}return count;}int main(){int n,m;while(cin>>n>>m){int max=get_count(n);int i,j;if(n>m){i=m;j=n;}else{i=n;j=m;}for(int k=i;k<=j;k++){if(max<get_count(k))max 阅读全文
posted @ 2012-02-13 19:23 Shirlies 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 简单题~~~#include <iostream>using namespace std;int gcd(int a,int b){if(b==0)return a;elsereturn gcd(b,a%b);}int main(){int T;int m,n;cin>>T;while(T--){cin>>m>>n;if(m==1){cout<<"NO"<<endl;continue;}if(gcd(n,m)==1){cout<<"NO"<<endl;}els 阅读全文
posted @ 2012-02-13 18:52 Shirlies 阅读(139) 评论(0) 推荐(0) 编辑
摘要: 经典的数学题啊~~~题解:http://blog.csdn.net/cscj2010/article/details/6768395感触:数学还是得灵活应用啊,关键是这个公式啊……起初是打算用大数做的,觉得好麻烦,就搜了一下,看一下别人的思路,我晕,竟然可以这样思考,NB啊~~~还有就是因为后面约了一个式子,但是这个n得足够大,所以要先存储前面的几个数……#include "stdio.h"#include "math.h"int fib[50]={0,1};int main(){int n,i;double a;double ig,fp;for(i=2 阅读全文
posted @ 2012-02-13 10:53 Shirlies 阅读(490) 评论(0) 推荐(0) 编辑