QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#84934#1875. Neinle0nWA 9ms2128kbC++141.2kb2023-03-06 21:06:472023-03-06 21:06:56

Judging History

This is the latest submission verdict.

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-06 21:06:56]
  • Judged
  • Verdict: WA
  • Time: 9ms
  • Memory: 2128kb
  • [2023-03-06 21:06:47]
  • Submitted

answer

#include <cstdio>
#include <cstring>

using namespace std;
typedef long long ll;

__int128 DP[55][552], p10[42];
int F[251];
int wow[55];

int main()
{
	int k, i, j, a, b, c, d, e, f, B;
	ll n;
	__int128 ans = 0, p = 1, T;
	scanf("%d%lld", &k, &n);
	for(i = 1; i <= k; i++)
		p *= 10;
	p10[0] = 1;
	for(i = 1; i <= 36; i++)
		p10[i] = p10[i - 1] * 10;
	p--;
	B = 35 / k + 1;
	for(i = 0; i < (ll)k * B; i++)
		for(j = 0; j < 9; j++)
		{
			wow[i] = j;
			f = 0;
			for(a = 1; a < B; a++)
			{
				T = p * a;
				memset(DP, 0, sizeof(DP));
				for(b = 0; b < k; b++)
				{
					if(b)
						for(c = 0; c < B; c++)
							DP[b][c * 10 + (T / p10[k - b - 1]) % 10] = DP[b - 1][c];
					else
						DP[0][T / p10[k - 1]] = 1;
					for(c = 0; c < B; c++)
						for(d = 0; d <= 9 * B; d++)
							if(c * k + b <= i)
								DP[b][d] = DP[b][d + wow[c * k + b]];
							else
								for(e = 1; e < 9; e++)
									DP[b][d] += DP[b][d + e]; 
				}
				if(DP[k - 1][0] >= n)
				{
					f = 1;
					break;
				}
				n -= DP[k - 1][0];
			}
			if(f)
				break;
		}
	for(i = 0; i < (ll)k * B; i++)
		ans = 10 * ans + wow[i];
	ans /= p;
	printf("%lld\n", (ll)ans);
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 9ms
memory: 2128kb

input:

1 1

output:

2

result:

ok answer is '2'

Test #2:

score: 0
Accepted
time: 6ms
memory: 2100kb

input:

1 8

output:

9

result:

ok answer is '9'

Test #3:

score: 0
Accepted
time: 9ms
memory: 2040kb

input:

1 9

output:

12

result:

ok answer is '12'

Test #4:

score: 0
Accepted
time: 9ms
memory: 2044kb

input:

1 10

output:

13

result:

ok answer is '13'

Test #5:

score: 0
Accepted
time: 9ms
memory: 2100kb

input:

5 1

output:

11112

result:

ok answer is '11112'

Test #6:

score: 0
Accepted
time: 8ms
memory: 2032kb

input:

5 84

output:

11235

result:

ok answer is '11235'

Test #7:

score: 0
Accepted
time: 5ms
memory: 2044kb

input:

5 668

output:

12345

result:

ok answer is '12345'

Test #8:

score: 0
Accepted
time: 8ms
memory: 2096kb

input:

5 733942

output:

2281488

result:

ok answer is '2281488'

Test #9:

score: -100
Wrong Answer
time: 5ms
memory: 2124kb

input:

18 528599760553218747

output:

888888888888888889

result:

wrong answer expected '30725517742188427234', found '888888888888888889'