25.
#include <stdio.h>
int main ()
{
int n;
scanf("%d",&n);
if(n>=0)
{
if(n>0)
{
printf("sign(%d) = 1\n",n);
else printf("sign(%d) = 0\n",n);
}
}
else printf("sign(%d) = -1\n",n);
return 0;
}
26.
#include<stdio.h>
int main()
{
int arr[3];
scanf("%d %d %d",&arr[0],&arr[1],&arr[2]);
int i;
int index;
int temp;
int j;
for(i=0;i<2;i++)
{
index=i;
temp=arr[i];
for(j=i+1;j<3;j++)
{
if(arr[j]<=arr[index]) index=j;
}
arr[i]=arr[index];
arr[index]=temp;
}
printf("%d->%d->%d\n",arr[0],arr[1],arr[2]);
return 0;
}
27.
#include<stdio.h>
int main()
{
int m;
int n;
scanf("%d %d",&m,&n);
int t1=n+n*0.1;
int t2=n+n*0.5;
printf("%d %d\n",t1,t2);
if(m<t1) printf("OK\n");
if(m>=t1&&m<t2)
{
double temp1=(m-n)/(double)n*100.0;
double temp2=temp1-(int)temp1;
int temp;
if(temp2>=0.5) temp=(int)temp1+1;
else temp=(int)temp1;
printf("Exceed %d%%. Ticket 200\n",temp);
}
if(m>=t2)
{
double temp1=(m-n)/(double)n*100.0;
double temp2=temp1-(int)temp1;
int temp;
if(temp2>=0.5) temp=(int)temp1+1;
else temp=(int)temp1;
printf("Exceed %d%%. License Revoked\n",temp);
}
return 0;
}
28