Submission #1208694

#TimeUsernameProblemLanguageResultExecution timeMemory
1208694horiaboeriuSubway (info1cup19_subway)C++20
100 / 100
4 ms840 KiB
#include <bits/stdc++.h> using namespace std; int main() { //cel mai bine este ca fiecare x sa fie fiul lui x - 1, asa vor fi un nr maxim de drumuri int k, s, n, i; scanf("%d", &k); if (k == 0) { printf("1\n0 -1\n"); } else { n = 1; while (n * (n + 1) / 2 < k) { n++; } s = n * (n - 1) / 2;//ultima suma < k n++; printf("%d\n0 -1\n", n); for (i = 1; i < n - 1; i++) { printf("%d %d\n", i, i - 1); } printf("%d %d\n", i, k - s - 1); } return 0; }

Compilation message (stderr)

subway.cpp: In function 'int main()':
subway.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     scanf("%d", &k);
      |     ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...