上一页 1 ··· 5 6 7 8 9 10 11 12 下一页

2015年12月31日

摘要: 总时间限制:1000ms内存限制:65536kB描述菲波那契数列是指这样的数列: 数列的第一个和第二个数都为1,接下来每个数都等于前面2个数之和。给出一个正整数k,要求菲波那契数列中第k个数是多少。输入输入一行,包含一个正整数k。(1 int main(){ int k; int a=1... 阅读全文
posted @ 2015-12-31 15:19 noip之路 阅读(632) 评论(0) 推荐(0) 编辑
 

2015年12月24日

摘要: #includeint main(){int n;double x,sum=0;scanf("%d",&n);for (int i=1;i<=n;i++){scanf("%lf",&x);sum=sum+x;}printf("%.4lf",sum/n);return 0;} 阅读全文
posted @ 2015-12-24 17:18 noip之路 阅读(860) 评论(0) 推荐(0) 编辑
 
摘要: #includeint main(){int n,x,sum=0;scanf("%d",&n);for (int i=1;i<=n;i++){scanf("%d",&x);sum=sum+x;}printf("%.2lf",(double)sum/n);return 0;}http://noi.op... 阅读全文
posted @ 2015-12-24 16:47 noip之路 阅读(2202) 评论(0) 推荐(0) 编辑
 

2015年12月23日

摘要: 【引例】 输出一行10个“*”#includeint main(){ printf("**********\n"); return 0;}View Code思考:(1)输出一行100个“*”(2)输出一行1000个“*”(3)输出……引入for#includeint main(){ ... 阅读全文
posted @ 2015-12-23 09:33 noip之路 阅读(530) 评论(0) 推荐(0) 编辑
 

2015年10月8日

摘要: (找第k大的数) 给定一个长度为1,000,000的无序正整数序列,以及另一个数n(1using namespace std;int a[1000001],n,ans = -1;void swap(int &a,int &b){int c;c = a; a = b; b = c;}int FindK... 阅读全文
posted @ 2015-10-08 10:39 noip之路 阅读(1167) 评论(0) 推荐(0) 编辑
 

2015年7月15日

摘要: 菜鸟一枚,为了观察区别,特地运行了下面几个语句 1 /*阅读程序回答问题, 2 1.bool类型的false对应数值?true呢? 3 2.非0整数对应bool型的?0呢? 4 */ 5 #include 6 #include 7 using namespace std; 8 int main... 阅读全文
posted @ 2015-07-15 17:09 noip之路 阅读(2658) 评论(0) 推荐(0) 编辑
 

2015年7月14日

摘要: 下面的程序出现了奇怪的错误:主要原因是对数组的定义理解不透彻,程序中的b[2][100];只含有2个一维数组b[0]和b[1],根本没有定义b[2],当然也不会给它初始化,所以运行时会出现意料之外的错误。#include#include#includeusing namespace std;int ... 阅读全文
posted @ 2015-07-14 19:00 noip之路 阅读(228) 评论(0) 推荐(0) 编辑
 
摘要: 递归是一种算法结构,回溯是一种算法思想 阅读全文
posted @ 2015-07-14 17:03 noip之路 阅读(190) 评论(0) 推荐(0) 编辑
 

2015年7月13日

摘要: 输入自然数n(n0) 如何继续分解呢,a[cur+1]=? a[cur+1]的取值范围:a[cur]~m/2 (因为 m-a[cur+1]>=a[cur+1],则a[cur+1]/2 2 #include 3 using namespace std; 4 int a[100],b[100]; 5 i... 阅读全文
posted @ 2015-07-13 16:41 noip之路 阅读(691) 评论(0) 推荐(0) 编辑
 

2015年7月12日

摘要: 辗转相除法:当a % b=0 时gcd(a,b)=b,否则gcd(a,b)=gcd(b,a%b)原理:(来源于百度)设两数为a、b(b1),则m=kn+xd=kyd+xd=(ky+x)d,则a=mc=(ky+x)dc,b=nc=ycd,故a与b最大公约数成为cd,而非c,与前面结论矛盾】从而可知gc... 阅读全文
posted @ 2015-07-12 16:20 noip之路 阅读(242) 评论(0) 推荐(0) 编辑
 
上一页 1 ··· 5 6 7 8 9 10 11 12 下一页