我寻思题目也没说z前面o的数量乘以z和j之间o的数量等于j后面o的数量啊?
#define _CRT_SECURE_NO_WARNINGS #include <cstdio> #include <string> using namespace std; int main() { char str[1001]; while (scanf("%s", str) != EOF) { string list = str; // z和j所在字符串中的下标 int pos1 = list.find('z'); int pos2 = list.find('j'); string list_1 = list.substr(0, pos1); string list_2 = list.substr(pos1 + 1, pos2 - pos1 - 1); string list_3 = list.substr(pos2+1); // z前面o的数量乘以z和j之间o的数量等于j后面o的数量 int len_1 = list_1.size(); int len_2 = list_2.size(); if (!len_2) { printf("Wrong Answer\n"); break; } int len_3 = list_3.size(); if (len_1 * len_2 == len_3) { printf("Accepted\n"); } else { printf("Wrong Answer\n"); } } return 0; }