回复 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]);
}
----------------解决方案--------------------------------------------------------