Comparison of Android versions(strcmp的应用)
Description
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
Each test case consists of a single line containing two build numbers, separated by a space character.
Output
● 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
Sample Output
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的应用)的更多相关文章
- HDU5099——Comparison of Android versions(简单题)(2014上海邀请赛重现)
Comparison of Android versionsProblem DescriptionAs an Android developer, itˇs really not easy to fi ...
- 模拟 HDOJ 5099 Comparison of Android versions
题目传送门 /* 题意:比较型号的大小 模拟:坑点在长度可能为5,此时设为'A' */ #include <cstdio> #include <algorithm> #incl ...
- HDOJ 5099 Comparison of Android versions 坑题
现场赛的时候错了十四次. . ... Comparison of Android versions Time Limit: 2000/1000 MS (Java/Others) Memory L ...
- hdoj-5099-Comparison of Android versions
Comparison of Android versions Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (J ...
- The YubiKey -- COMPARISON OF VERSIONS
COMPARISON OF YUBIKEY VERSIONS BASICSTANDARD & NANO BASICEDGE & EDGE-N PREMIUMNEO & NE ...
- Android官方文档翻译 十五 3.3Supporting Different Platform Versions
Supporting Different Platform Versions 支持不同的平台版本 This lesson teaches you to 这节课教给你 Specify Minimum a ...
- Android Platform Guide
This guide shows how to set up your SDK environment to deploy Cordova apps for Android devices, and ...
- Android Hook框架adbi源码浅析(一)
adbi(The Android Dynamic Binary Instrumentation Toolkit)是一个Android平台通用hook框架,基于动态库注入与inline hook技术实现 ...
- android hook 框架 ADBI 如何实现so注入
Android so注入-libinject2 简介.编译.运行 Android so注入-libinject2 如何实现so注入 Android so注入-Libinject 如何实现so注入 A ...
随机推荐
- 移动端利用canvas画布简单实现刮刮乐效果
为了研究canvas一些属性简单实现的一个小效果 代码样式不太规范 随手写的 请问喷 初学者可以看下 css代码 <style> * { margin: 0; padding: 0; } ...
- animation(动画)设置
1.animation 动画 概念:当您在 @keyframes 中创建动画时,请把它捆绑到某个选择器,否则不会产生动画效果. 通过规定至少以下两项 CSS3 动画属性,即可将动画绑定到选择器: 规定 ...
- Google+百度,自动识别知名人物的性别
最近有一个任务,需要采集一批知名学者的性别信息.该任务的难点在于提供学者信息的网站并不会主动标注学者的性别性别,因此只能靠别的方法了. 对一个普通人来说,在网上判断一个人的性别的最快的方式就是看他的照 ...
- Java : java基础(5) Socket网络编程
使用 DatagramSocket 创建一个 UDP协议的Socket, 用DatagramPacket创建一个数据包,可以指定ip和端口号以及包的数据,用socket.send()可以发送这个数据包 ...
- 如何在 EXCEL 2003 插入的方框内打对勾,复选框
一个方框里带勾的符号是吧第一种:EXCEL里有个插入符号的功能知道吧,打开它在符号那栏(不是特殊符号那栏),下拉字体找到Wingdings字体,在下面的符号中就能找到框中带勾的符号 第二种:在界面点& ...
- 几个简单if程序的细节比较与加法程序设计
关于简单的if判断语句的不同写法: 输出0-9十个整数: 第一个程序: #include<stdio.h> #include<stdlib.h> int main() { ; ...
- 成都Uber优步司机奖励政策(2月17日)
滴快车单单2.5倍,注册地址:http://www.udache.com/ 如何注册Uber司机(全国版最新最详细注册流程)/月入2万/不用抢单:http://www.cnblogs.com/mfry ...
- vue.js中引入其他文件export的方法:
import {GetPosition} from '../../lib/utils' //找到 该方法的文件路径,然后 用{}拿到 该方法 var position =GetPosition(); ...
- Java:多线程中的volatile
一.为什么使用volatile 首先,通过一段简单的代码来理解为什么要使用volatile: public class RunThread extends Thread{ private boolea ...
- STM32F746G-DISCO官方例程烧写
1. 首先安装STM32 ST-LINK Utility v3.9.0.exe,必须V3.9版本(官方说的) 2. 打开软件,选择External Loader,选择N25Q128A_STM32F74 ...