#include #include #include #include #include int ToInt(char str[10]); void Init(char* init); void ParseNumArray(char* ver, int* intVer); int main() { char fossilVer[6] = "1.0.5"; char assessVer[6] = "0.5.2"; int fossil[3] = { 0 }; int assess[3] = { 0 }; int chrItr = 0; int intItr = 0; char buff[4] = ""; scanf("%s", fossilVer); scanf("%s", assessVer); ParseNumArray(fossilVer, fossil); ParseNumArray(assessVer, assess); for (int i = 0;i < 3;i++) { if (fossil[i] > assess[i]) { printf("YES\n"); return; } else if (fossil[i] < assess[i]) { printf("NO\n"); return; } } printf("YES\n"); return 0; } int ToInt(char str[10]) { int re_num = 0; for (int i = 0;str[i] != '\0';i++) { int num = str[i] - 48; if (num > 9 || num < 0) { return -1; } re_num = re_num * 10; re_num += num; } return re_num; } void Init(char* init) { for (int i = 0;init[i] != '\0';i++) { init[i] = '\0'; } } void ParseNumArray(char* ver, int* intVer) { int chrItr = 0; int intItr = 0; char buff[4] = ""; for (int i = 0;;i++) { if (ver[i] == '.' || ver[i] == '\0') { intVer[intItr] = ToInt(buff); intItr++; chrItr = 0; Init(buff); if (ver[i] == '\0') { break; } continue; } buff[chrItr] = ver[i]; chrItr++; } }