Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- ID: mickyta1
- TASK: frac1
- LANG: C++
- */
- #include <bits/stdc++.h>
- using namespace std;
- #define f first
- #define s second
- typedef pair<int, int> pii;
- bool comp(const pii &lhs, const pii &rhs){
- int l = lhs.f * rhs.s;
- int r = rhs.f * lhs.s;
- return l < r;
- }
- set<pii, decltype(&comp)> stt(comp);
- int main(){
- freopen("frac1.in", "r", stdin);
- freopen("frac1.out", "w", stdout);
- int n;
- scanf("%d", &n);
- stt.emplace(0, 1);
- stt.emplace(1, 1);
- for(int i = 1; i <= n - 1; ++i){
- for(int j = i + 1; j <= n; ++j){
- stt.emplace(i, j);
- }
- }
- for(pii p : stt){
- cout << p.f << '/' << p.s << '\n';
- }
- fclose(stdin);
- fclose(stdout);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement