0
#include <iostream> using namespace std; int main() { int nums[3] = {0, 0, 0}; int fact[3] = {0, 0, 0}; int fc; for(int a = 1; a <= 1000; a++) { fc = 0; for(int b = 1; b < a; b++) { int mod = a % b; if (mod == 0) { fc++; } } for(int c = 0; c < 3; c++) { if (fc > fact[c]) { fact[c] = fc; nums[c] = a; break; } } } cout << nums[0] << ": " << fact[0] << endl; cout << nums[1] << ": " << fact[1] << endl; cout << nums[2] << ": " << fact[2] << endl; return 0; }
23rd Dec 2017, 10:42 PM
zama