제출 #761211

#제출 시각아이디문제언어결과실행 시간메모리
761211KN200711Rack (eJOI19_rack)C++14
100 / 100
2 ms304 KiB
# include <bits/stdc++.h> # define ll long long using namespace std; const ll MOD = 1e9 + 7; ll fast(ll a, ll b) { if(b == 0) return 1ll; if(b == 1) return a; ll K = fast(a, b/2ll); K *= K; K %= MOD; if(b&1) { K *= a; K %= MOD; } return K; } ll add(ll a, ll b) { a += b; a %= MOD; return a; } int main() { ll N, K; scanf("%lld %lld", &N, &K); ll ans = 0ll; for(int i=N;i>=1;i--) { if(i == 1) { if(K&1) ans = add(ans, 1ll); else ans = add(ans, 2ll); } else { if(K&1) { } else { ans = add(ans, fast(2ll, 1ll * i - 1ll)); } } K = (K + 1ll) / 2ll; } printf("%lld\n", ans); return 0; }

컴파일 시 표준 에러 (stderr) 메시지

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