"Thinking": First hit the table, after the cycle.
"AC Code":
#include <iostream> #include <algorithm> #include <iomanip> #include <cstdio> #include < cmath>using namespace std; #define MAX 10000int Prime_list[max], cnt = 0;int isprime (int n) {int i = 0;for (i = 2; i < = sqrt (n); i++) {if (0 = = n%i) return 0;} return 1;} void MakeList (int a, int b) {int i = 0, j = 0;for (i = 2; I <= b; i++) {if (IsPrime (i)) {prime_list[j++] = i;cnt++;}}} int main () {//freopen ("In.txt", "R", stdin);//freopen ("OUT.txt", "w", stdout); int a = 0, b = 0;int i = 0, j = 0;//inputcin >> a >> b;makelist (A, b);//outputfor (i = A; I <=b; i++) {cout << i << "="; int temp = i, flag = 1;; while (1! = temp) {for (j = 0; J < CNT; J + +) {if (0 = = Temp%prime_list[j]) {if (flag) {cout << prime_list[j];flag = 0 ;} Elsecout << "*" << prime_list[j];temp/= Prime_list[j];break;}}} cout << Endl;} return 0;}
Blue Bridge Cup BASIC 16 decomposition factorization (mathematics)