寫個水題

來源:互聯網
上載者:User

2000

#include<stdio.h>
int main()
{
 int i,j;
char ch[4],temp;
while(scanf("%s",&ch)!=EOF)

{

 for (i=0;i<3;i++)
 {
  for(j=i;j<3;j++)
   if(ch[i]>ch[j])
   {
    temp=ch[i];
    ch[i]=ch[j];
    ch[j]=temp;
   }
 }

 printf("%c %c %c/n",ch[0],ch[1],ch[2]);

}

 return 0;
}

//_________________________________//

#include<stdio.h>
int main()
{
 int i,j;
char ch[4],temp;
while(scanf("%c",&ch[0])!=EOF)

{
 for(i=1;i<4;i++)
 {scanf("%c",&ch[i]);
 if(ch[i]==EOF) break;}
 for (i=0;i<3;i++)
 {
  for(j=i;j<3;j++)
   if(ch[i]>ch[j])
   {
    temp=ch[i];
    ch[i]=ch[j];
    ch[j]=temp;
   }
 }

 printf("%c %c %c/n",ch[0],ch[1],ch[2]);

}

 return 0;
}

//_________________________________________________//

2001

#include<stdio.h>
#include<math.h>
int main()
{
 float x1,y1,x2,y2,dis;
while (scanf("%f %f %f %f",&x1,&y1,&x2,&y2)!=EOF)
{
dis=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));

printf("%.2f/n",dis);

}

return 0;
}

//_________________________

2002

 #include<stdio.h>
#include<math.h>

#define PI 3.1415927
int main()
{
   double r;
   while(scanf("%lf",&r)!=EOF)
   {
    printf("%.3f/n",4.0*r*r*r*PI/3.0);
   
   
   }

 

return 0;
}

//________________________

2003

#include<stdio.h>
#include<math.h>
int main()
{
   double r;
   while(scanf("%lf",&r)!=EOF)
   {
   printf("%.2lf/n",fabs(r));
   
   }

return 0;
}

//_________________________________

2005

#include<stdio.h>
int main()
{
   int y,m,d,i,days=0;
   int ordim[13]={0,31,28,31,30,31,30,31,31,30,31,30,31},
    rm[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
   while(scanf("%d/%d/%d",&y,&m,&d)!=EOF)
   {
    days=0;
             if(y%4==0&&y%100!=0||y%400==0)
    {
    for(i=0;i<m;i++)
     days+=rm[i];
    days+=d;
    }
    else
   {
    for(i=0;i<m;i++)
    { days+=ordim[i];}
    days+=d;
    }

   printf("%d/n",days);
   
   }

return 0;
}

//2004_______________________________--

#include<stdio.h>
int main()
{
   int score;
   while(scanf("%d",&score)!=EOF)
   {
             if(score>89&score<=100)
     printf("A/n");
     if(score>79&score<90)
     printf("B/n");
     if(score>69&score<80)
     printf("C/n");
    if(score>59&score<70)
     printf("D/n");
      if(score>0&score<60)
     printf("E/n"); 
   if(score>100|score<0)
      printf("Score is error!/n");
   
   }

return 0;
}

//_____________________________________2006

#include<stdio.h>
int main()
{
   int i,n,isj,result=1;
   while(scanf("%d",&n)!=EOF)
   {
    result=1;
        for(i=0;i<n;i++)
  { scanf("%d",&isj);   
   
     if(isj%2!=0)
  result*=isj;
  }
  printf("%d/n",result);
   }

return 0;
}

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.