摘要: 没做完,先搞答题了#include #include#includeint comp(const void *a,const void *b){ return *(int*)a-*(int*)b;}int main(){ //----part1 for(int i=100;i1000&&sumi... 阅读全文
posted @ 2015-04-10 20:24 夜歌乘年少 阅读(568) 评论(0) 推荐(0) 编辑
摘要: //主要是要找到f(n)=2*f(n-1)-1的规律.#include #include int f(int n){ if(n==0) return 2; else return 2*f(n-1)-1;}int main(){ printf("%d",f(10));} 阅读全文
posted @ 2015-04-10 17:33 夜歌乘年少 阅读(274) 评论(0) 推荐(0) 编辑
摘要: //迭代公式不是很理解,写出来算了。。#include #include int main(){ double x0,x1; int a; scanf("%d",&a); x0=a/2; x1=(x0+a/x0)/2; while(fabs(x0-x1)>=1e-... 阅读全文
posted @ 2015-04-10 17:12 夜歌乘年少 阅读(369) 评论(0) 推荐(0) 编辑
摘要: //C代码简直难看到家,求大神知道如何写出复用性好的,维护性强的代码。。。//格式错误了好几次,最后发现是are和数字之间多了个空格。。。。。。本来一直以为是最后的换行多了,费劲搞掉了。#include#includeint main(){ int n,temp; scanf("%d",&n); f... 阅读全文
posted @ 2015-04-10 16:51 夜歌乘年少 阅读(325) 评论(0) 推荐(0) 编辑
摘要: 之前没做对的一道题,今天集中清理一下。//-------------------很水的题,主要是 %.2lf不能四舍五入,需要仅保留两位小数,用了丑陋的强制类型转换。。。//------------------#include#define PI 3.14int main(){ double r,h... 阅读全文
posted @ 2015-04-10 16:15 夜歌乘年少 阅读(661) 评论(0) 推荐(0) 编辑