2 solutions

  • 2
    @ 2021-12-26 17:41:58

    思路

    开始样例给的有问题,后面更改了,很显然1到n的排列本身就是两两互质,所以直接输出n即可

    Code

    #include<bits/stdc++.h>
    using namespace std;
    #define ll long long
    int main()
    {
    	ll n;
    	cin>>n;
    	cout<<n;
    	return 0;
    }
    
    • 1
      @ 2023-8-15 15:16:25

      这题很离谱,看了答案才理解。两个相邻的数一定是互为质数的,并且1和任意一个数互质。因此,这个质数环可以是1,2,3,---,n,再回到1。 即这个环中含有n个数。

      #include<bits/stdc++.h>
      using namespace std;
      
      int main(){
          long long n;
          cin>>n;
          cout<<n; 
          return 0;
      }
      
      • 1

      Information

      ID
      266
      Time
      1000ms
      Memory
      256MiB
      Difficulty
      4
      Tags
      # Submissions
      236
      Accepted
      115
      Uploaded By