Submission #1244825

#TimeUsernameProblemLanguageResultExecution timeMemory
1244825CrabCNHUzastopni (COCI17_uzastopni)C++20
80 / 80
1 ms328 KiB
#include <bits/stdc++.h>

#define int long long
#define pii pair <int, int>
#define fi first
#define se second

using namespace std;

const int N = 1e5 + 5;
const int inf = 1e18 + 7;

int a[N];

signed main () {
    ios_base :: sync_with_stdio (0);
    cin.tie (0);
    cout.tie (0);
    #define task "crab"
    if (fopen (task".inp", "r")) {
        freopen (task".inp", "r", stdin);
        freopen (task".out", "w", stdout);
    }
    int n;
    cin >> n;
    int lim = n * 2;
    for (int i = 2; i * i <= lim; i ++) {
        if (lim % i == 0) {
            int j = lim / i;
            if ((i + j) % 2 == 1) {
                cout << (j - i - 1) / 2 + 1 << ' ' << (i + j + 1) / 2 - 1 << '\n';
            } 
        }
    }
}

Compilation message (stderr)

uzastopni.cpp: In function 'int main()':
uzastopni.cpp:21:17: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |         freopen (task".inp", "r", stdin);
      |         ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
uzastopni.cpp:22:17: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |         freopen (task".out", "w", stdout);
      |         ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...