Created
October 29, 2022 13:10
-
-
Save modos/eb6e4873f909dba5922ded592911d132 to your computer and use it in GitHub Desktop.
Gheyme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// In The Name Of God | |
#include<bits/stdc++.h> | |
using namespace std; | |
#define ll long long | |
const int mod = 1000000007; | |
const int maxn = 1010; | |
int main(){ | |
int n,k; cin >> n >> k; | |
if(k > 3){ | |
cout << 0 << endl; | |
} | |
if(k == 3){ | |
int ans = 0; | |
for(int x = 1; x < n; x++) for(int y = 1; y < n-x; y++) if(__gcd(x,y) == 1) ans = (ans+n-(x+y))%mod; | |
cout << ans << endl; | |
} | |
if(k == 2){ | |
cout << (n*(n-1))/2 << endl; | |
} | |
if(k == 1){ | |
cout << n << endl; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment