2 条题解

  • 1
    @ 2023-4-1 20:44:56
    #include<iostream>
    using namespace std;
    int n,m;
    void paint(int x){
    	cout<<x<<"=";
    	a:;
     	for(int i=2;i<=x;i++){
    		if(x%i==0){
    			cout<<i;
    			x/=i;
    			if(x!=1){//如果不是最后一个因数
    				cout<<"*";
    				goto a;//回到a的位置
    			}
    		}
    	}
    	cout<<endl;
    }
    int main(){
    	cin>>n>>m;
    	for(int i=n;i<=m;i++)paint(i);
    	return 0;
    }
    
    • 0
      @ 2024-9-8 10:56:38
      #include<bits/stdc++.h>
      using namespace std;
      const int N=1e5+10;
      int main()
      {
      	int m, n;
      	cin >> m >> n;
      	for(int i = m; i <= n; i++)
      	{
      		cout << i << "=";
      		int t = i, j = 2, sum = 0;
      		while(t > 1)
      		{
      			while(t % j == 0)
      			{
      				t /= j;
      				if(sum++)
      					cout << "*";
      				cout << j;
      			}
      			j++;
      		}
      		cout << endl;
      	}
      	return 0;
      }
      
      • 1

      信息

      ID
      976
      时间
      1000ms
      内存
      128MiB
      难度
      8
      标签
      递交数
      12
      已通过
      9
      上传者