답안 #19415

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
19415 2016-02-24T11:35:58 Z golala123 Σ (kriii4_P2) C++
0 / 100
14 ms 1720 KB
#include <iostream>
#include <stdio.h>
#include <vector>
using namespace std;
long long a ,b , total;
long long ans = 1;
int t;
const int MOD = 1000000007;
int x = 1000000005;
int main(){
	cin >> t >> b >> a;
	while (t--){
		vector<long long> m;
		vector< pair<int, int > > two;
		long long temp = 1;
		int i = 0;
		m.push_back(b);
		while (temp < MOD){
			long long aa = 1;
			aa = m[i] % MOD * m[i] % MOD;
			aa %= MOD;
			m.push_back(aa%MOD);
			temp *= 2;
			i++;
		}
		int j = 0;
		while (x != 0){
			if (x % 2 == 1)
				two.push_back({ j, x % 2 });
			x /= 2;
			j++;
		}
		for (int i = 0; i < two.size(); i++){
			if (two[i].second == 1){
				ans = ans*m[two[i].first] % MOD;
				ans %= MOD;
			}
		}
		ans = a*ans % MOD;
		total += ans;
		total %= total;
	}
	cout << total;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 14 ms 1720 KB Output isn't correct
2 Halted 0 ms 0 KB -