UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#210372#3782. 神奇钢笔Yhlms1000ms1252kbC++111.5kb2024-08-06 11:41:492024-08-06 12:12:54

answer

#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
#define int long long
//fixed << setprecision()

int n;
int num[10] = {13, 1, 2, 3, 5, 4, 4, 2, 2, 2};
int w[8] = {0, 2, 6, 3, 3 , 3, 6};
unsigned int ans = 0;
int ww;

int get_max(int nn)
{
	if(nn == 1)
		return 1; 
	if(nn == 2)
		return 9; 
	if(nn == 3)
		return 10;
	if(nn == 4)
		return 1000;
	if(5 <= nn && nn <= 11)
		return 9100;
	if(nn == 12)
		return 9100;
	if(13 <= nn && nn <= 13)
		return 9900;
	if(nn == 16)
		return 9910;
	if(nn == 17)
		return 9990;
	if(nn == 18)
		return 9991;
	if(nn >= 19)
		return 9999;
}

signed main()
{
	ios::sync_with_stdio(false);
	cin >> n;
	if(n >= 88)
	{
		cout << 9999999999999999 << endl;	
		return 0;
	} 
	if(n == 1)
	{
		cout << 1 << endl;
	}
	if(n == 2)
	{
		cout << 9 << endl;
	}
	if(n == 3)
	{
		cout << 10 << endl;
	}
	if(n == 4)
	{
		cout << 100000000 << endl;
	}
	if(n == 5)
	{
		cout << 900000000 << endl;
	}
	if(n == 6)
	{
		cout << 90000000 << endl;
	}
	ans = 1000000000000;
	if(n > 6)
	{
		n -= 6;
		if(n <= 19)
		{
			cout << ans * get_max(n) << endl;
			return 0;
		}
		ans = 9999000000000000;
		n -= 19 + 3;
		int ww = 100000000;
		if(n <= 19)
		{
			
			cout << ans + (ww * get_max(n)) << endl;
			return 0;
		}
		ans = 9999999900000000;
		n -= 19 + 3;
		ww = 10000;
		if(n <= 19)
		{
			
			cout << ans + (ww * get_max(n)) << endl;
			return 0;
		}
		n -= 19;
		ans = 9999999999990000;
		cout << ans + get_max(n) << endl;
	}
	return 0;
}

详细

小提示:点击横条可展开更详细的信息

Test #1:

score: 10
Accepted
time: 0ms
memory: 1248kb

input:

9

output:

10000000000000

result:

ok "10000000000000"

Test #2:

score: 10
Accepted
time: 0ms
memory: 1244kb

input:

10

output:

1000000000000000

result:

ok "1000000000000000"

Test #3:

score: 10
Accepted
time: 0ms
memory: 1244kb

input:

87

output:

9999999999999991

result:

ok "9999999999999991"

Test #4:

score: 10
Accepted
time: 0ms
memory: 1248kb

input:

88

output:

9999999999999999

result:

ok "9999999999999999"

Test #5:

score: 10
Accepted
time: 0ms
memory: 1252kb

input:

100

output:

9999999999999999

result:

ok "9999999999999999"

Test #6:

score: 10
Accepted
time: 0ms
memory: 1248kb

input:

69

output:

9999999999990000

result:

ok "9999999999990000"

Test #7:

score: 10
Accepted
time: 0ms
memory: 1244kb

input:

66

output:

9999999999100000

result:

ok "9999999999100000"

Test #8:

score: 10
Accepted
time: 0ms
memory: 1244kb

input:

54

output:

9999999910000000

result:

ok "9999999910000000"

Test #9:

score: 10
Accepted
time: 0ms
memory: 1244kb

input:

85

output:

9999999999999910

result:

ok "9999999999999910"

Test #10:

score: 10
Accepted
time: 0ms
memory: 1248kb

input:

44

output:

9999991000000000

result:

ok "9999991000000000"

Extra Test:

score: 0
Extra Test Passed