#include "iostream"\n#include "string"\n#include "set"\nusing namespace std;\n\nint main() {\n int y, n;\n cin >> y >> n;\n int x = 0;\n string year = to_string(y);\n set digitSet;\n while (digitSet.size() != n) {\n x++;\n year = to_string(y + x);\n digitSet.clear();\n for (char digit : year) {\n digitSet.insert(digit);\n }\n }\n cout << x << " " << year << endl;\n return 0;\n}

C++程序:判断年份数字不重复

原文地址: https://www.cveoy.top/t/topic/pzzf 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录