3 条题解

  • 1
    @ 2025-12-9 19:04:06
    #include<bits/stdc++.h>
    using namespace std;
    int main(){
        int n;
        cin>>n;
        for(int i=2;i<=n;i++) 
        	if(n%i==0) { 
          	    cout<<n/i<<endl;
          	    break;
        	}
        return 0;
    }
    
    • -1
      @ 2025-12-4 20:29:26

      #include #include using namespace std;

      int main() { long long n; cin >> n;

      // 从2开始寻找n的第一个质因数(即较小的那个质数)
      for (long long i = 2; i * i <= n; i++) {
          if (n % i == 0) {
              // 找到了较小的质因数i,较大的质数就是n/i
              cout << n / i << endl;
              return 0;
          }
      }
      
      return 0;
      

      }

      • -1
        @ 2025-12-4 20:29:14

        #include #include using namespace std;

        int main() { long long n; cin >> n;

        // 从2开始寻找n的第一个质因数(即较小的那个质数)
        for (long long i = 2; i * i <= n; i++) {
            if (n % i == 0) {
                // 找到了较小的质因数i,较大的质数就是n/i
                cout << n / i << endl;
                return 0;
            }
        }
        
        return 0;
        

        }

        • 1

        信息

        ID
        6941
        时间
        1000ms
        内存
        128MiB
        难度
        3
        标签
        递交数
        18
        已通过
        12
        上传者