zoukankan      html  css  js  c++  java
  • 1061. Dating (20)

     1 #include <stdio.h>
     2 #include <map>
     3 #include <string.h>
     4 #include <ctype.h>
     5 using namespace std;
     6 int main()
     7 {
     8    map<char,int> ToHour;
     9    int i;
    10    for(i=0;i<=9;i++)
    11        ToHour['0'+i]=i;
    12    for(i='A';i<='N';i++)
    13        ToHour[i]=i-'A'+10;
    14    
    15    char Week[7][4]={ "MON", "TUE", "WED", "THU", "FRI","SAT","SUN"};
    16 
    17    char line1[61],line2[61],line3[61],line4[61];
    18 
    19    while(gets(line1)!=NULL)
    20    {
    21        gets(line2);
    22        gets(line3);
    23        gets(line4);
    24        int fir=1;
    25        for(i=0;i<(strlen(line1)<strlen(line2)?strlen(line1):strlen(line2));i++)
    26        {
    27            if(line1[i]==line2[i]&&line1[i]>='A'&&line1[i]<='G')
    28            {
    29                   printf("%s",Week[line1[i]-'A']);
    30                   break;   
    31            }
    32        }
    33 
    34        for(++i;i<(strlen(line1)<strlen(line2)?strlen(line1):strlen(line2));i++)
    35        {
    36            if(line1[i]==line2[i]&&((line1[i]>='A'&&line1[i]<='N')||(line1[i]>='0'&&line1[i]<='9')))
    37            {
    38                       printf(" %02d",ToHour[line1[i]]);
    39                        break;  
    40            }
    41        }
    42 
    43         for(i=0;i<(strlen(line3)<strlen(line4)?strlen(line3):strlen(line4));i++)
    44         {
    45             if(line3[i]==line4[i]&&isalpha(line3[i]))
    46             {
    47                 printf(":%02d
    ",i);
    48                 break;
    49             }
    50         }
    51    }
    52    
    53 }
  • 相关阅读:
    【Office】Word排版
    小猪的压力
    SQL SERVER 自定义函数参数数量对调用时参数数量的影响
    工作效率
    C#使用SharpZipLib编辑zip包中内容
    SQL SERVER——自定义函数
    C#字符串编码
    在ASP.NET中启动SQL SERVER缓存
    C#延迟加载
    C#格式化DateTime时间
  • 原文地址:https://www.cnblogs.com/xiaoyesoso/p/4264951.html
Copyright © 2011-2022 走看看