一只RE了的蒟蒻T-T
查看原帖
一只RE了的蒟蒻T-T
756900
When_can_I_be楼主2022/9/26 22:09

RT。

#include<iostream>
using namespace std;
int main(){

    int n,s[1005],cnt=0;
    cin>>n;

    for(int i=1;i<n;i++){

        bool flag=true;
        for(int j=0;j<i;j++){
            if(i%j==0)flag=false;

        }
        if(flag){
            s[cnt]=i;
            cnt++;
        }
    }
    for(int i=0;i<cnt;i++){
        for(int j=i;j<cnt;j++){
            if(s[j]*s[i]==n){
                cout<<j;
                return 0;
            }
        }
    }

    return 0;
}
2022/9/26 22:09
加载中...