HDU 5099 Comparison of Android versions (pit water problem)

Source: Internet
Author: User

C-comparison of Android versionsHDU 5099

Time Limit: MS Memory Limit: 32768 KB

64-bit integer IO format: %i64d,%i64u Java class name: Main

[Submit] [Status]

Descriptionas an Android developer, Itˇs really isn't easy-to-figure out a newer version of the kernels, because Android is Updated so frequently and have 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 is ordered alphabetically. The latest code name is K (KitKat).
The second letter are a branch code that allows Google to identify the exact code branch that the build were made from, and R is by convention the primary release branch.

The next letter and the digits is a date code. The letter counts quarters, with A being Q1 2009. Therefore, F is Q2 2010. The 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 compare the Android build numbers. Inputthe first line is a integer n (1 <= n <=), which indicates how many test cases need to process.

Each of the test case consists of a is a single line containing the build numbers, separated by a space character. Outputfor each test case, output A, starting with¨case #:〃 (# means the number of the 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 the builds is not in the same Code branch, just compare the date code; If they is in the same Code branch, compare the date code together with the individual version. Sample Input
2frf85b epf21bktu84l ktu84m
Sample Output
Case 1: > >case 2: = <

Execute time:0.001556 S, 2 db Queris.


rule: The first judgment number is determined to compare the first character of the two string, and the second Judge numberthe determinationis the second string that judges two strings, and if not the same, only two strings are compared.3rd to 5th characters, if the same need to compare the following characters (the string is only 6 characters)
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <iostream> #include <    Algorithm> #include <math.h>using namespace Std;int n;char str1[10],str2[10];int main () {int k = 0;    scanf ("%d", &n);        while (n--) {k++;        scanf ("%s%s", STR1,STR2);        Char Ch,ch2;        if (Str1[0] > str2[0]) {ch = ' > ';        } else if (Str1[0] < str2[0]) {ch = ' < ';        } else {ch = ' = ';            } if (str1[1] = = str2[1]) {int flag = 0;  for (int i=2; i<=5; i++) {if (Str1[i] > Str2[i]) {flag =                    1;                    CH2 = ' > ';                Break                    } else if (Str1[i] < Str2[i]) {flag = 1;                    CH2 = ' < ';                Break }} if (flAG = = 0) {CH2 = ' = ';            }} else {int flag = 0;  for (int i=2; i<=4; i++) {if (Str1[i] > Str2[i]) {flag =                    1;                    CH2 = ' > ';                Break                    } else if (Str1[i] < Str2[i]) {flag = 1;                    CH2 = ' < ';                Break            }} if (flag = = 0) {CH2 = ' = ';    }} printf ("Case%d:%c%c\n", K,CH,CH2); } return 0;}

HDU 5099 Comparison of Android versions (pit water problem)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.