bnu1065 时尚的辉蛋 C语言版

来源:互联网 发布:手机淘宝可以买火车票 编辑:程序博客网 时间:2024/04/28 16:27
北京师范大学珠海分校
Judge Online of ACM ICPC
1065 时尚的辉蛋
C语言版
  1. #include <stdio.h>

  2. int main(){
  3.     double score[12][3]={{0.75,0.80,0.70},{0.65,0.78,0.92},{0.72,0.60,0.85},{0.85,0.95,0.88},{0.73,0.69,0.84},{0.92,0.87,0.69},{0.66,0.86,0.76},{0.75,0.92,0.80},{0.86,0.77,0.95},{0.84,0.78,0.90},{0.97,0.68,0.87},{0.66,0.79,0.63}};
  4.     char name[12][20]={"Capricorn","Aquarius","Pisces","Aries","Taurus","Gemini","Cancer","Leo","Virgo","Libra","Scorpio","Sagittarius"};
  5.     char point[3][20]={"luck point:","love point:","success point:"};
  6.     int i,j,y,m,d;
  7.     char c;
  8.     while(1){
  9.         scanf("%d-%d-%d",&y,&m,&d);
  10.         if (y==9999&&m==12&&d==31) break;
  11.         getchar();
  12.         scanf("%c",&c);
  13.         if ((m==12&&d>=22)||(m==1&&d<=19)) i=1;
  14.         else if ((m==1&&d>=20)||(m==2&&d<=18)) i=2;
  15.         else if ((m==2&&d>=19)||(m==3&&d<=20)) i=3;
  16.         else if ((m==3&&d>=21)||(m==4&&d<=19)) i=4;
  17.         else if ((m==4&&d>=20)||(m==5&&d<=20)) i=5;
  18.         else if ((m==5&&d>=21)||(m==6&&d<=21)) i=6;
  19.         else if ((m==6&&d>=21)||(m==7&&d<=22)) i=7;
  20.         else if ((m==7&&d>=23)||(m==8&&d<=22)) i=8;
  21.         else if ((m==8&&d>=23)||(m==9&&d<=22)) i=9;
  22.         else if ((m==9&&d>=23)||(m==10&&d<=22)) i=10;
  23.         else if ((m==10&&d>=23)||(m==11&&d<=21)) i=11;
  24.         else if ((m==11&d>=22)||(m==12&&d<=21)) i=12;
  25.         switch(c){
  26.             case 'A':j=2;break;
  27.             case 'X':j=1;break;
  28.             case 'S':j=3;break;
  29.         }
  30.         printf("%s/n%s %.2lf/n",name[i-1],point[j-1],score[i-1][j-1]);
  31.     }
  32.     return 0;
  33. }

原创粉丝点击