基本思想:
无;
关键点:
无;
#include<iostream> #include<string> #include<vector> using namespace std; void devide(string s, int n, int& r) { for (int i = 0; i < s.size(); i++) { int temp = (s[i] - '0') + r * 10; r = temp % n; s[i] = temp/n + '0'; } } int main() { string s; while (cin >> s) { if (s == "-1") break; string res = ""; for (int i = 2; i < 10; i++) { int r = 0; devide(s, i, r); if (r == 0) { res += char(i + '0'); res += " "; } } if (res.size() == 0) cout << "none" << endl; else { res.pop_back(); cout << res << endl; } } }