提交时间:2025-03-30 16:53:10

运行 ID: 8528

#include <bits/stdc++.h> using namespace std; bool zhishu(int n) { for(int i = 2;i * i <= n;i++) { if(n % i == 0) { return false; } } return true; } int main() { int l,r; cin>>l>>r; for(int i = l;i <= r;i++) { cout<<i<<"="; if(zhishu(i)) { cout<<i<<endl; continue; } int number = i; int sum = 2; do { while(number % sum == 0) { cout<<sum; number /= sum; if(number != 1) { cout<<"*"; } } sum++; }while(number != 1); cout<<endl; } return 0; }