Description

As an Android developer, itˇs really not easy to figure out a newer version of two kernels, because Android is updated so frequently and has many branches. Fortunately, Google identifies individual builds with a short build code, e.g. FRF85B.

The first letter is the code name of the release family, e.g. F is Froyo. The code names are ordered alphabetically. The latest code name is K (KitKat). 
The second letter is a branch code that allows Google to identify the exact code branch that the build was made from, and R is by convention the primary release branch.

The next letter and two digits are a date code. The letter counts quarters, with A being Q1 2009. Therefore, F is Q2 2010. The two digits count days within the quarter, so F85 is June 24 2010.

Finally, the last letter identifies individual versions related to the same date code, sequentially starting with A; A is actually implicit and usually omitted for brevity.

Please develop a program to compare two Android build numbers.

 

Input

The first line is an integer n (1 <= n <= 2000), which indicates how many test cases need to process.

Each test case consists of a single line containing two build numbers, separated by a space character.

 

Output

For each test case, output a single line starting with ¨Case #: 〃 (# means the number of the test case). Then, output the result of release comparison as follows:

● Print "<" if the release of the first build number is lower than the second one; 
● Print "=" if the release of the first build number is same as he second one; 
● Print ">" if the release of the first build number is higher than the second one.

Continue to output the result of date comparison as follows: 
● Print "<" if the date of the first build number is lower than the second one; 
● Print "=" if the date of the first build number is same as he second one; 
● Print ">" if the date of the first build number is higher than the second one.

If two builds are not in the same code branch, just compare the date code; if they are in the same code branch, compare the date code together with the individual version.

 

Sample Input

2
FRF85B EPF21B
KTU84L KTU84M
 

Sample Output

Case 1: > >
Case 2: = <
 
题目意思:这是一个安卓版本代码的比较,这里每组数据有两个代码代表不同的安卓版本分别得出版本的大小和日期的大小。版本代码中第一个字母代表着大版本,第二个字母代表分支版本,第三四五代表着日期,最后一个字母代表与日期相关的单个版本。题目要求是,先比较大版本,之后比较日期。如果分支版本相同,那么既要比较日期还要比较和日期相关的单个版本,如果分支版本不同,那么只需比较日期即可。
 
解题思路:前两天我还刚刚给我的大魅族升级到了安卓8.0,另一台华为也升级到了8.0,都彻底吃上了奥利奥。这个题对于不了解安卓版本的人来说看起来确实吃点力,实际上这个问题化简来看就可以看成:

1、比较两个字符串的第一个字母的大小;

2、如果两个字符串的第二个字母不同就比较接下来的三个字母的大小,如果第二个字母相同就比较剩余的四个字母!

 就是strcmp的应用

 #include<stdio.h>
#include<string.h>
int main()
{
int n,i,j,k,m;
char s1[],s2[],a[],b[];
scanf("%d",&n);
getchar();
for(i=; i<=n; i++)
{
memset(a,,sizeof(a));
memset(b,,sizeof(b));
memset(s1,,sizeof(s1));
memset(s2,,sizeof(s2));
scanf("%s %s",s1,s2);
printf("Case %d: ",i);
if(s1[]==s2[])
{
printf("= ");
}
else if(s1[]>s2[])
{
printf("> ");
}
else if(s1[]<s2[])
{
printf("< ");
}
k=;
m=;
if(s1[]==s2[])
{
for(j=; j<=; j++)
{
a[k++]=s1[j];
b[m++]=s2[j];
a[k]='\0';
b[m]='\0';
}
}
else
{
for(j=; j<=; j++)
{
a[k++]=s1[j];
b[m++]=s2[j];
a[k]='\0';
b[m]='\0';
}
}
if(strcmp(a,b)==)
printf("=");
else if(strcmp(a,b)<)
{
printf("<");
}
else if(strcmp(a,b)>)
{
printf(">");
}
printf("\n");
}
return ;
}
 
 
 

Comparison of Android versions(strcmp的应用)的更多相关文章

  1. HDU5099——Comparison of Android versions(简单题)(2014上海邀请赛重现)

    Comparison of Android versionsProblem DescriptionAs an Android developer, itˇs really not easy to fi ...

  2. 模拟 HDOJ 5099 Comparison of Android versions

    题目传送门 /* 题意:比较型号的大小 模拟:坑点在长度可能为5,此时设为'A' */ #include <cstdio> #include <algorithm> #incl ...

  3. HDOJ 5099 Comparison of Android versions 坑题

    现场赛的时候错了十四次. . ... Comparison of Android versions Time Limit: 2000/1000 MS (Java/Others)    Memory L ...

  4. hdoj-5099-Comparison of Android versions

    Comparison of Android versions Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (J ...

  5. The YubiKey -- COMPARISON OF VERSIONS

    COMPARISON OF YUBIKEY VERSIONS   BASICSTANDARD & NANO BASICEDGE & EDGE-N PREMIUMNEO & NE ...

  6. Android官方文档翻译 十五 3.3Supporting Different Platform Versions

    Supporting Different Platform Versions 支持不同的平台版本 This lesson teaches you to 这节课教给你 Specify Minimum a ...

  7. Android Platform Guide

    This guide shows how to set up your SDK environment to deploy Cordova apps for Android devices, and ...

  8. Android Hook框架adbi源码浅析(一)

    adbi(The Android Dynamic Binary Instrumentation Toolkit)是一个Android平台通用hook框架,基于动态库注入与inline hook技术实现 ...

  9. android hook 框架 ADBI 如何实现so注入

    Android so注入-libinject2 简介.编译.运行 Android so注入-libinject2  如何实现so注入 Android so注入-Libinject 如何实现so注入 A ...

随机推荐

  1. es6新特性之 class 基本用法

    javaScript 语言中,生成实例对象的传统方法是通过构造函数,与传统的面向对象语言(比如 C++ 和 Java)差异很大,ES6 提供了更接近传统语言的写法,引入了 class(类)这个概念,作 ...

  2. windows下labelme的安装

    1.安装Anaconda 2.进入Anaconda文件夹下 3.输入conda create --name=labelme python=3.5 4.输入activate labelme 然后建立的l ...

  3. 学习 Linux_kernel_exploits 小记

    Linux_kernel_exploits+ 功能:自动生成UAF类型漏洞exp文件的工具,目前缺少文档介绍,可以参考test文件下的使用实例,但是源码中缺少dataflowanalyzer模块+ 相 ...

  4. CSS中的动画

    1.transition 在CSS3中,可以通过transition为元素从一种样式变换为另外一种样式的过程添加效果. transition为简写属性,用于在一个属性中设置四个过渡属性,分别是: tr ...

  5. Spark_安装配置_运行模式

    一.Spark支持的安装模式: 1.伪分布式(一台机器即可) 2.全分布式(至少需要3台机器) 二.Spark的安装配置 1.准备工作 安装Linux和JDK1.8 配置Linux:关闭防火墙.主机名 ...

  6. python教程(一)·简介

    先简单介绍下python.(真的很简单) python是什么? Python是Guido van Rossum发布于1991年的一种计算机程序设计语言.是一种动态的.面向对象的脚本语言,是一种解释型的 ...

  7. PTA基础编程题目集7-1厘米换算英尺英寸

    如果已知英制长度的英尺foot和英寸inch的值,那么对应的米是(foot+inch/12)×0.3048.现在,如果用户输入的是厘米数,那么对应英制长度的英尺和英寸是多少呢?别忘了1英尺等于12英寸 ...

  8. Div标签使用inline-block有间距

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  9. java-执行流程控制语句

    就像有知觉的生物一样,程序必须在执行的过程中控制它的世界,并做出选择.java使用执行流程控制语句做出选择. 1.选择语句 if if(布尔表达式){ 业务逻辑1; }else{ 业务逻辑2: } s ...

  10. java static代码块执行时机

    之前一直认为static块是在class load的时候执行,今天在验证Spring初始化Context loader的时候,发现bean的static块并没有执行. Java代码: 1 Class ...