Run ID:136256

提交时间:2025-11-09 22:47:47

#include <iostream> #include <vector> #include <string> using namespace std; bool check(int ab, int cde, int &fgh, int &ijk, int &lmn, int &opqrst) { int c = cde / 100; // C int d = (cde / 10) % 10; // D int e = cde % 10; // E fgh = ab * e; // FGH = AB * E ijk = ab * d; // IJK = AB * D lmn = ab * c; // LMN = AB * C opqrst = fgh + ijk * 10 + lmn * 100; // OPQRST = FGH + IJK*10 + LMN*100 // 检查 FGH、IJK、LMN 是否都是三位数 if (fgh < 100 || ijk < 100 || lmn < 100) return false; // 检查 OPQRST 是否是一个六位数 if (opqrst < 100000 || opqrst > 999999) return false; return true; } int main() { for (int ab = 10; ab <= 99; ++ab) { for (int cde = 1000; cde <= 9999; ++cde) { int fgh, ijk, lmn, opqrst; if (check(ab, cde, fgh, ijk, lmn, opqrst)) { cout << ab << endl; // 输出 AB cout << cde << endl; // 输出 CDE cout << fgh << endl; // 输出 FGH cout << ijk << endl; // 输出 IJK cout << lmn << endl; // 输出 LMN return 0; } } } return 0; }