|
[求助]菜鸟又有问题了。大家帮忙看看我这段代码问题出在哪
#include<stdio.h> #include<math.h> void main() { long int i,m,n,x,y,p; m=10; t=0; y=0l scanf("%ld",&n); for(i=1;i<=n;i++) { p=n-i; t=t+n*pow(m,p); } for(x=0;x<=n-1;x++) { y=y+t/pow(m,x); } printf("%ld\n",y); } 应该是这样的。终于太我算出来了。 这么简单的一个算法,妈的让我这菜鸟算了好2个多小时; 我不得不怀疑是为是学C的料了。:( |
|
[求助]菜鸟又有问题了。大家帮忙看看我这段代码问题出在哪
#include<stdio.h> #include<math.h> void main() { long int i,m,n,x,y,p; m=10; t=0; scanf("%ld",&n); for(i=1;i<=n;i++) { p=n-i; t=t+n*pow(m,p); } for(x=1;x<=n-1;x++) { y=t+t/pow(m,x); } printf("%ld\n",y); } 输错了,应该是这样。 第一个循环可以出来。第二个就不行了。 |
|
|
|
|
操作理由
RANk
{{ user_info.golds == '' ? 0 : user_info.golds }}
雪币
{{ experience }}
课程经验
{{ score }}
学习收益
{{study_duration_fmt}}
学习时长
基本信息
荣誉称号:
{{ honorary_title }}
能力排名:
No.{{ rank_num }}
等 级:
LV{{ rank_lv-100 }}
活跃值:
在线值:
浏览人数:{{ visits }}
最近活跃:{{ last_active_time }}
注册时间:{{ user_info.create_date_jsonfmt }}
勋章
兑换勋章
证书
证书查询 >
能力值