Submission #19352

# Submission time Handle Problem Language Result Execution time Memory
19352 2016-02-24T10:25:54 Z bshnet Α (kriii4_P1) C++14
Compilation error
0 ms 0 KB
#include <iostream>

#define MOD (1000000007)
using namespace std;
typedef long long int64_t;

int pow(int64_t a, int64_t x) {
	int64_t sq[64];
	int ans = 1;

	sq[0] = (a % MOD);
	for(int i = 1; i <= 64; ++i) {
		if(x & 0x01)
			ans = (ans * sq[i-1]) % MOD;

		x >>= 1;
		if(!x)
			break;

		sq[i] = (sq[i-1] * sq[i-1]) % MOD;
	}

	return ans;
}

int main(void) {
	int64_t A, X;
	cin >> A >> X;
	cout << pow(A, X) << endl;
	return 0;
}

Compilation message

P1.cpp:5:19: error: conflicting declaration ‘typedef long long int int64_t’
 typedef long long int64_t;
                   ^
In file included from /usr/lib/gcc/x86_64-linux-gnu/4.9/include/stdint.h:9:0,
                 from /usr/include/c++/4.9/cstdint:41,
                 from /usr/include/c++/4.9/bits/char_traits.h:380,
                 from /usr/include/c++/4.9/ios:40,
                 from /usr/include/c++/4.9/ostream:38,
                 from /usr/include/c++/4.9/iostream:39,
                 from P1.cpp:1:
/usr/include/stdint.h:40:19: note: previous declaration as ‘typedef long int int64_t’
 typedef long int  int64_t;
                   ^