标签:std esc while 因数分解 cto deb stream str output
#include <cstdio> #include <iostream> #include <cmath> #include <string> #include <cstring> #include <algorithm> #include <queue> #include <vector> #include <map> using namespace std; #define ll long long const int inf = 0x3f3f3f3f; const int mod = 1e9+7; int a, b, tot, pri[10000+8], en[10000+8]; bool is[10000+8]; void E() { tot = 0; memset(is, 1, sizeof(is)); is[0] = is[1] = 0; for(int i = 2; i<10000+8; i++) { if(is[i]) { pri[tot++] = i; for(int j = i+i; j<10000+8; j += i) is[j] = 0; } } } int main() { E(); while(~scanf("%d%d", &a, &b)) { for(int i = a; i <= b; i++) { int id = 0, buffer = i; for(int j = 0; j < tot && pri[j]*pri[j] <= i; j++) { if(buffer%pri[j] == 0) { while(buffer%pri[j] == 0) { en[id++] = pri[j]; buffer /= pri[j]; } } } if(buffer>1)en[id++] = buffer; printf("%d=", i); bool flag = 0; for(int j = 0; j<id; j++) { if(flag)printf("*"); flag = 1; printf("%d", en[j]); } printf("\n"); } } return 0; }
标签:std esc while 因数分解 cto deb stream str output
原文地址:https://www.cnblogs.com/RootVount/p/11252860.html