Submission #1045622

#TimeUsernameProblemLanguageResultExecution timeMemory
1045622ezzzayOdd-even (IZhO11_oddeven)C++14
0 / 100
0 ms348 KiB
#include <bits/stdc++.h> #define pb push_back #define endl "\n" #define mp make_pair #define fi first #define se second #define all(x) x.begin(), x.end() #define fname "" #define sz(x) (int)(x.size()) typedef long long ll; using namespace std; const ll N = (ll)(5e5) + 322; const ll INF = (ll)(2e9); const ll mod = (ll)(1e9) + 7; const double eps = 1e-9; ll n, l = 0, r = INF, ans; ll calc(ll x) {return (x) * (x + 1) / 2ll;} int main () { ios_base :: sync_with_stdio (false); cin.tie(0); //freopen(fname".in", "r", stdin); //freopen(fname".out", "w", stdout); scanf("%lld", &n); while (r - l > 1) { ll mid = (r + l) / 2ll; if (calc(mid) >= n) r = mid; else l = mid; } ans = n + (n - l - 1); printf("%lld", ans); return 0; }

Compilation message (stderr)

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