当前位置: 代码迷 >> C语言 >> 现在正在考试中,大家帮帮小弟的忙吧!
  详细解决方案

现在正在考试中,大家帮帮小弟的忙吧!

热度:287   发布时间:2008-06-11 08:37:33.0
回复 1# lukechen1990 的帖子
#inlude<stdio.h>
main()
{
int plusresult , q , i = j = 1;
plusresult = 0;
scanf("%d",&q);
while(plusresult+1<=q)
{
plusresult = plusresult + ( i + 1 )/i ;
++i;
}
printf("%d",plusresult)
}
----------------解决方案--------------------------------------------------------
回复 1# lukechen1990 的帖子
#include<stdio.h>
void exchange( int x ,int y)
{
int t ;
t = x ;
x = y ;
y = t ;
}
int max(int x , int y )
{
int t ;
t = x>y?x:y ;
return t ;
}
main()
{
int a[10] , b[2];
for(int i = 0 ; i<10 ; i++ )
{
scanf("%d",a[i]);
}
int t = a[0] ;
for(i = 0;i<10 ;i++)
{
if(t==a[i])
continue ;
else
t = max( t ,a[i] );
}
for(i=0; i<10 ; i++)
if(t == a[i])
break;
exchange( a[0],a[i]);
b[0] = a[0] ;
a[0]=a[1];
t = a[0] ;
for(i = 0;i<10 ;i++)
{
if(t==a[i])
continue ;
else
t = max( t ,a[i] );
}
for(i=0; i<10 ; i++)
if(t == a[i])
break;

exchange( a[1],a[i]);
a[0] = b[0] ;
for(i=0;i<10;i++)
printf("%d",&a[i]);
}
----------------解决方案--------------------------------------------------------
  相关解决方案