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. chromium之message_pump_win之三

    上一篇分析MessagePumpForUI,参考chromium之message_pump_win之二 MessagePumpForIO,同MessagePumpForUI,也是要实现三个函数 // ...

  2. Oracle批量删除表格数据

    在开发阶段往Oracle数据库中多个表格中导入了许多测试数据,倘若一张张表执行"truncate table tablename"语句显得十分繁琐.在PL/SQL中可以用代码进行批 ...

  3. JQuery制作网页——第五章 初识 jQuery

    1.jQuery简介: ● jQuery由美国人John Resig于2006年创建 ● jQuery是目前最流行的JavaScript程序库,它是对JavaScript对象和函数的封装 ● 它的设计 ...

  4. 壹度DIY_微信小程序组件_小程序插件开发

    开源免费插件,diy特有的页面机制,搭配30+自定义组件,让你的站点每一个页面都可以完全自定义,可无缝对接任意小程序,如有疑问加入qq壹度小程序交流群:302866773:或wx:liu2417301 ...

  5. 关于PHPExcel 导出下载表格,调试器响应乱码

    PHPExcel导出表格是日常程序开发很常见的一功能,有些小伙伴千辛万苦把代码写好之后,运行一下结果发现浏览器没反应,表格下载不了或者表格乱码!!!像这种情况有三种解决方法: 1.在header 之前 ...

  6. linux进程篇 (三) 进程间的通信3 IPC通信

    3 IPC通信 用户空间 进程A <----无法通信----> 进程B -----------------|--------------------------------------|- ...

  7. VS中添加lib与dll

    参考与拓展阅读:https://blog.csdn.net/u012043391/article/details/54972127 lib: 1.附加包含目录---添加工程的头文件目录:       ...

  8. VIM Commands

    Vim Commands Commands in NORMAL modes Motions small granular: move by direction k h l j mid granular ...

  9. MongoDB 安装 增删改查

    MongoDB   一 介绍 1.高性能的数据存储解决方案是大多数大型Web应用程序和服务的核心.后端数据库负责存储一切东西,从用户账户的信息到购物车中的商品,以及博客和评论数据等.好的Web应用需要 ...

  10. 如何去除Eclipse下的JS引入报错(类似Syntax error on token...的异常信息)

    在Eclipse下引入外部JS文件,比如Jquery.js,经常会出现如下异常信息: 去除该异常方法: 1. 去掉Eclipse的JS验证 Windws---->Preferences----& ...