답안 #1097242

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1097242 2024-10-06T14:41:21 Z vjudge1 Rack (eJOI19_rack) C++17
100 / 100
9 ms 8028 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
const ll MOD = 1000000007;
int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(0);
    ll n,k;
    cin >> k>>n;
    vector<ll>a(k,0LL);
    n--;
    ll i =0 ;
    while(n>0){
      a[i]=n%2LL;
      n/=2LL;
      i++;
    }reverse(a.begin(),a.end());
    ll x = 1;
    ll act = 1;
    for(ll i=0;i<a.size();i++){
      if(a[i]!=0)x+=act*a[i];
      x%=MOD;
      act*=2LL;
      act%=MOD;
    }cout << x << endl;
  
  return 0;
}

Compilation message

rack.cpp: In function 'int main()':
rack.cpp:20:17: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |     for(ll i=0;i<a.size();i++){
      |                ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 856 KB Output is correct
15 Correct 9 ms 8028 KB Output is correct