Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<string>
- #include<vector>
- #include<algorithm>
- #include<stack>
- using namespace std;
- int main()
- {
- long long int k,n,m;
- cin>>k>>n>>m;
- if(k == 0 && n==0 && m==0)
- {
- cout<<1;
- return 0;
- }
- if(k == 0)
- {
- if((n+1)*(m+1) == 1)
- cout<<1;
- else
- cout<<1<<"/"<<(n+1)*(m+1)-1;
- return 0;
- }
- int positive = 0;
- int negative = 0;
- for(int i = 0;i<=n;i++)
- {
- for(int j = 0;j<=m;j++)
- {
- if((k - (i*2+j*3)) == 0)
- positive++;
- else
- negative++;
- }
- }
- if(positive % (positive+negative) == 0)
- cout<<positive/(positive+negative);
- else
- cout<<positive<<"/"<<positive+negative;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement