답안 #581109

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
581109 2022-06-22T09:17:28 Z masmc05 Rack (eJOI19_rack) C++17
컴파일 오류
0 ms 0 KB
#include <iostream>
#define int long long
using namespace std;
const long long mod=1e9+7;
long long int logExp(long long int num, long long e){
    if (e == 1) return num;
    if (e == 0) return 1;
    long long int fin = logExp(num, e >> 1) % mod;
    fin = (fin * fin) % mod;
    if (e & 1) fin = (fin * num) % mod;
    return fin;
}
int32_t main()
{
    long long n, k;
    cin >> n >> k;
    long long res = 0;
    k--;
    for (long long i = n - 1; i >= 0; i--) {
        int child = k & 1;
        k = k >> 1;
        if (child == 1) res = (res + logExp(2, i) % mod ) % mod;
    }
    cout << (res + 1) % mod;

    return 0;
}

Compilation message

rack.cpp:2:13: error: 'long long long' is too long for GCC
    2 | #define int long long
      |             ^~~~
rack.cpp:5:11: note: in expansion of macro 'int'
    5 | long long int logExp(long long int num, long long e){
      |           ^~~
rack.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
rack.cpp:5:11: note: in expansion of macro 'int'
    5 | long long int logExp(long long int num, long long e){
      |           ^~~
rack.cpp:2:13: error: 'long long long' is too long for GCC
    2 | #define int long long
      |             ^~~~
rack.cpp:5:32: note: in expansion of macro 'int'
    5 | long long int logExp(long long int num, long long e){
      |                                ^~~
rack.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
rack.cpp:5:32: note: in expansion of macro 'int'
    5 | long long int logExp(long long int num, long long e){
      |                                ^~~
rack.cpp: In function 'long long int logExp(long long int, long long int)':
rack.cpp:2:13: error: 'long long long' is too long for GCC
    2 | #define int long long
      |             ^~~~
rack.cpp:8:15: note: in expansion of macro 'int'
    8 |     long long int fin = logExp(num, e >> 1) % mod;
      |               ^~~
rack.cpp:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
rack.cpp:8:15: note: in expansion of macro 'int'
    8 |     long long int fin = logExp(num, e >> 1) % mod;
      |               ^~~