Submission #79957

#TimeUsernameProblemLanguageResultExecution timeMemory
79957pzdbaUzastopni (COCI17_uzastopni)C++14
80 / 80
20 ms664 KiB
#include <bits/stdc++.h> using namespace std; typedef long long LL; int main(){ LL n; scanf("%lld", &n); for(LL i=2;i<=min(n, (LL)200000);i++){ LL lo = 1, hi = (n+i-1)/i; LL ans = -1; while(lo <= hi){ LL mid = (lo+hi)/2; LL st = mid, en = mid+i-1; LL le = en-st+1; LL val = (st+en)*le/2; if(val <= n){ if(val == n) ans = mid; lo = mid+1; } else hi = mid-1; } if(ans != -1){ printf("%lld %lld\n", ans, ans+i-1); } } }

Compilation message (stderr)

uzastopni.cpp: In function 'int main()':
uzastopni.cpp:6:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld", &n);
  ~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...