Submission #22412

#TimeUsernameProblemLanguageResultExecution timeMemory
22412PurpleNoon backward compatibility (#40)Fully Generate (KRIII5_FG)C++14
2 / 7
500 ms10324 KiB
#include <cstdio>
#include <queue>
using namespace std;
typedef long long lint;
lint mod = 1000000007;
const int N = 1000006;
queue < lint > q;
int main() {
	lint n = 1;
	scanf("%lld", &n);
	lint cnt = 5;
	q.push(3);
	q.push(3);
	//printf("1 2 2 ");
	lint ans = 4;
	for (lint i = 4; i <= n; ++i) {
		lint tmp = q.front();
		q.pop();
		ans = (ans*tmp) % mod;
		for (int j = 0; j < tmp; ++j) {
			q.push(i);
			++cnt;
			if (cnt > N)break;
		}
	}
	if (n == 1)
		puts("1");
	else if (n == 2)
		puts("2");
	else if (n == 3)
		puts("4");
	else
		printf("%lld\n", ans);
	return 0;
}

Compilation message (stderr)

FG.cpp: In function 'int main()':
FG.cpp:10:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld", &n);
                   ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...