Time Limit: 1000 MS Memory Limit: 32768 KB
64-bit integer IO format: %I64d , %I64u Java class name: Main
2 FRF85B EPF21B KTU84L KTU84M
Case 1: > > Case 2: = <
execute time:0.001556 s, 2 db queris.
#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(坑水题)
原文:http://blog.csdn.net/yeguxin/article/details/43570773