Submission #19443

# Submission time Handle Problem Language Result Execution time Memory
19443 2016-02-24T12:37:51 Z codingman Α (kriii4_P1) C++
Compilation error
0 ms 0 KB
#include <fstream>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <stack>
#include <string>
#include <regex>
#include <map>
#include <numeric>
using namespace std;
vector<string> s;
//string c;

long long A, X;
vector<int> Avector;
/*
첫 번째 줄에는 정수 A(1?≤?A?≤?10^18)이 주어진다.

두 번째 줄에는 정수 X(1?≤?X?≤?10^18)가 주어진다.
*/
int main()
{ 
	cin >> A >> X;
	long long mod = 1000000007;
	//Avector.push_back(1);

	long long temp = 1;
	Avector.push_back(A);
	//long long prevValue = A;
	int cnt = 1;
	while(1)
	{
		//if(temp >= X)
		//{
		//	break;
		//} 
		auto t = (Avector.back() % mod)* (Avector.back() % mod) % mod;
		if(cnt > X)
			break;
		else 
			Avector.push_back(t); 
		cnt <<= 1;
	}

	
	long long tX = X;
	vector<int> binary;
	while(tX)
	{
		//printf("%d", tX % 2);
		binary.push_back(tX % 2);
		tX /= 2;

	}

	long long result = 1;
	for(int i=0; i<binary.size(); i++)
	{
		if(binary[i])
		{
			result = (result  % mod) * (Avector[i] % mod) % mod; 
		}
	}


	cout << result;


	return 0;
}

Compilation message

In file included from /usr/include/c++/4.9/regex:35:0,
                 from P1.cpp:8:
/usr/include/c++/4.9/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support for the \
  ^
P1.cpp: In function ‘int main()’:
P1.cpp:38:3: warning: ‘auto’ changes meaning in C++11; please remove it [-Wc++0x-compat]
   auto t = (Avector.back() % mod)* (Avector.back() % mod) % mod;
   ^
P1.cpp:38:8: error: ‘t’ does not name a type
   auto t = (Avector.back() % mod)* (Avector.back() % mod) % mod;
        ^
P1.cpp:42:22: error: ‘t’ was not declared in this scope
    Avector.push_back(t); 
                      ^
P1.cpp:58:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0; i<binary.size(); i++)
                ^
P1.cpp:28:12: warning: unused variable ‘temp’ [-Wunused-variable]
  long long temp = 1;
            ^