답안 #22540

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
22540 2017-04-30T05:25:57 Z AJAE(#998, nona1314, adman, wowoto9772) Fully Generate (KRIII5_FG) C++
컴파일 오류
0 ms 0 KB
#include <cstdio>
#include <vector>

using namespace std;
using ll = long long;
ll MMOD = 1000000007;
ll SEXER;
ll popo(ll a, ll p) {
	ll r = 1;
	while (p) {
		if (p & 1) {
			r *= a;
			if(r >= MMOD) r %= MMOD;
		}
		a *= a;
		if(a >= MMOD) a %= MMOD;
		p >>= 1LL;
	}
	return r;
}

ll arr[31347599];
int sss[6] = { 0,1,2,4,12,36 };
int main()
{
	ll n;
	ll cnt = 0;
	ll ans = 1;
	scanf("%lld", &n);
	if (n <= 5) {
		printf("%d\n", sss[n]);
		return 0;
	}
	ll gsize = 4;
	arr[0] = 0;
	arr[1] = 1;
	arr[2] = 2;
	arr[3] = 2;
	cnt = 1 + 2 + 2;
	ans = 2 * 2 * 3 * 3;
	bool sw = true;
	for (int i = 3; sw; ++i) {
		ll &tmp = arr[i];
		ll ttmp = 1;
		int st = gsize;
		for (ll j = 0; j<tmp; ++j) {
			arr[gsize] = i;
			gsize++;
			cnt += i;
			if (cnt >= n) {
				ans *= popo(ttmp, i);
				if(ans >= MMOD) ans %= MMOD;
				arr[gsize - 1] = i - (cnt - n);
				ans *= popo(gsize - 1, arr[gsize - 1]);
				if (ans >= MMOD) ans %= MMOD;
				printf("%lld\n", ans);
				return 0;
			}
			ttmp *= (gsize - 1);
			if(ttmp >= MMOD) ttmp %= MMOD;
		}
		ans *= popo(ttmp, i);
		if(ans >= MMOD) ans %= MMOD;
	}

	return 0;
}

Compilation message

FG.cpp:5:7: error: expected nested-name-specifier before 'll'
 using ll = long long;
       ^
FG.cpp:6:1: error: 'll' does not name a type
 ll MMOD = 1000000007;
 ^
FG.cpp:7:1: error: 'll' does not name a type
 ll SEXER;
 ^
FG.cpp:8:1: error: 'll' does not name a type
 ll popo(ll a, ll p) {
 ^
FG.cpp:22:1: error: 'll' does not name a type
 ll arr[31347599];
 ^
FG.cpp: In function 'int main()':
FG.cpp:26:2: error: 'll' was not declared in this scope
  ll n;
  ^
FG.cpp:27:5: error: expected ';' before 'cnt'
  ll cnt = 0;
     ^
FG.cpp:28:5: error: expected ';' before 'ans'
  ll ans = 1;
     ^
FG.cpp:29:17: error: 'n' was not declared in this scope
  scanf("%lld", &n);
                 ^
FG.cpp:34:5: error: expected ';' before 'gsize'
  ll gsize = 4;
     ^
FG.cpp:35:2: error: 'arr' was not declared in this scope
  arr[0] = 0;
  ^
FG.cpp:39:2: error: 'cnt' was not declared in this scope
  cnt = 1 + 2 + 2;
  ^
FG.cpp:40:2: error: 'ans' was not declared in this scope
  ans = 2 * 2 * 3 * 3;
  ^
FG.cpp:43:7: error: 'tmp' was not declared in this scope
   ll &tmp = arr[i];
       ^
FG.cpp:44:6: error: expected ';' before 'ttmp'
   ll ttmp = 1;
      ^
FG.cpp:45:12: error: 'gsize' was not declared in this scope
   int st = gsize;
            ^
FG.cpp:46:11: error: expected ';' before 'j'
   for (ll j = 0; j<tmp; ++j) {
           ^
FG.cpp:46:18: error: 'j' was not declared in this scope
   for (ll j = 0; j<tmp; ++j) {
                  ^
FG.cpp:51:17: error: 'ttmp' was not declared in this scope
     ans *= popo(ttmp, i);
                 ^
FG.cpp:51:24: error: 'popo' was not declared in this scope
     ans *= popo(ttmp, i);
                        ^
FG.cpp:52:15: error: 'MMOD' was not declared in this scope
     if(ans >= MMOD) ans %= MMOD;
               ^
FG.cpp:55:16: error: 'MMOD' was not declared in this scope
     if (ans >= MMOD) ans %= MMOD;
                ^
FG.cpp:59:4: error: 'ttmp' was not declared in this scope
    ttmp *= (gsize - 1);
    ^
FG.cpp:60:15: error: 'MMOD' was not declared in this scope
    if(ttmp >= MMOD) ttmp %= MMOD;
               ^
FG.cpp:62:15: error: 'ttmp' was not declared in this scope
   ans *= popo(ttmp, i);
               ^
FG.cpp:62:22: error: 'popo' was not declared in this scope
   ans *= popo(ttmp, i);
                      ^
FG.cpp:63:13: error: 'MMOD' was not declared in this scope
   if(ans >= MMOD) ans %= MMOD;
             ^
FG.cpp:45:7: warning: unused variable 'st' [-Wunused-variable]
   int st = gsize;
       ^