QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#556245#4664. Broken ConnectionWorld_Creater0 1ms3748kbC++20930b2024-09-10 16:12:322024-09-10 16:12:32

Judging History

你现在查看的是最新测评结果

  • [2024-09-10 16:12:32]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:3748kb
  • [2024-09-10 16:12:32]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
string s;
int cnt[15];
int main()
{
	cin>>s;
	if(s=="Alice")
	{
		ll x;
		cin>>x;
		int sum=0;
		for(int i=9;i>=0;i--)
		{
			cnt[i]=x%10;
			x/=10;
			sum+=cnt[i];
		}
		if(sum>50)
		{
			for(int i=0;i<=9;i++) cnt[i]=9-i;
			cnt[0]+=10;
		}
		string ans;
		for(int i=0;i<=9;i++)
		{
			for(int j=1;j<=cnt[i];j++) ans+=to_string(i);
		}
		if(ans.empty())
		{
			for(int i=1;i<=50;i++)
			{
				ans+="0";
			}
		}
		cout<<ans;
	}
	if(s=="Bob")
	{
		string s;
		cin>>s;
		bool fl=s.length()==50;
		for(auto i:s)
		{
			fl&=i=='0';
		}
		if(fl)
		{
			cout<<0;
			return 0;
		}
		for(auto c:s)
		{
			cnt[c-'0']++;
		}
		if(cnt[0]>=10)
		{
			cnt[0]-=10;
			for(int i=0;i<=9;i++) cnt[i]=9-cnt[i];
		}
		ll pw=1,ans=0;
		for(int i=9;i>=0;i--)
		{
			ans+=pw*cnt[i];
			pw*=10;
		}
		cout<<ans;
	}
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3516kb

First Run Input

Alice
2022

First Run Output

668899

Second Run Input

Bob
989686

Second Run Output

2022

Manager to Checker

OK
Very Good!

result:

ok OK

Test #2:

score: 100
Accepted
time: 0ms
memory: 3748kb

First Run Input

Alice
20060411

First Run Output

22555555777789

Second Run Input

Bob
87527575555297

Second Run Output

20060411

Manager to Checker

OK
Very Good!

result:

ok OK

Test #3:

score: 100
Accepted
time: 1ms
memory: 3588kb

First Run Input

Alice
3

First Run Output

999

Second Run Input

Bob
999

Second Run Output

3

Manager to Checker

OK
Very Good!

result:

ok OK

Test #4:

score: 100
Accepted
time: 1ms
memory: 3588kb

First Run Input

Alice
4

First Run Output

9999

Second Run Input

Bob
9999

Second Run Output

4

Manager to Checker

OK
Very Good!

result:

ok OK

Test #5:

score: 100
Accepted
time: 1ms
memory: 3732kb

First Run Input

Alice
5

First Run Output

99999

Second Run Input

Bob
99999

Second Run Output

5

Manager to Checker

OK
Very Good!

result:

ok OK

Test #6:

score: 100
Accepted
time: 1ms
memory: 3748kb

First Run Input

Alice
6

First Run Output

999999

Second Run Input

Bob
999999

Second Run Output

6

Manager to Checker

OK
Very Good!

result:

ok OK

Test #7:

score: 100
Accepted
time: 1ms
memory: 3536kb

First Run Input

Alice
7

First Run Output

9999999

Second Run Input

Bob
9999999

Second Run Output

7

Manager to Checker

OK
Very Good!

result:

ok OK

Test #8:

score: 100
Accepted
time: 1ms
memory: 3580kb

First Run Input

Alice
8

First Run Output

99999999

Second Run Input

Bob
99999999

Second Run Output

8

Manager to Checker

OK
Very Good!

result:

ok OK

Test #9:

score: 100
Accepted
time: 1ms
memory: 3736kb

First Run Input

Alice
9

First Run Output

999999999

Second Run Input

Bob
999999999

Second Run Output

9

Manager to Checker

OK
Very Good!

result:

ok OK

Test #10:

score: 100
Accepted
time: 1ms
memory: 3540kb

First Run Input

Alice
10

First Run Output

8

Second Run Input

Bob
8

Second Run Output

10

Manager to Checker

OK
Very Good!

result:

ok OK

Test #11:

score: 100
Accepted
time: 1ms
memory: 3704kb

First Run Input

Alice
11

First Run Output

89

Second Run Input

Bob
98

Second Run Output

11

Manager to Checker

OK
Very Good!

result:

ok OK

Test #12:

score: 100
Accepted
time: 1ms
memory: 3732kb

First Run Input

Alice
12

First Run Output

899

Second Run Input

Bob
989

Second Run Output

12

Manager to Checker

OK
Very Good!

result:

ok OK

Test #13:

score: 100
Accepted
time: 1ms
memory: 3532kb

First Run Input

Alice
1

First Run Output

9

Second Run Input

Bob
9

Second Run Output

1

Manager to Checker

OK
Very Good!

result:

ok OK

Test #14:

score: 100
Accepted
time: 1ms
memory: 3580kb

First Run Input

Alice
0

First Run Output

00000000000000000000000000000000000000000000000000

Second Run Input

Bob
00000000000000000000000000000000000000000000000000

Second Run Output

0

Manager to Checker

OK
Very Good!

result:

ok OK

Test #15:

score: 100
Accepted
time: 1ms
memory: 3580kb

First Run Input

Alice
5536137883

First Run Output

0000011111222333333455566666667777777788888888999

Second Run Input

Bob
3703762771186762687081160083578303432768615995889

Second Run Output

5536137883

Manager to Checker

OK
Very Good!

result:

ok OK

Test #16:

score: 100
Accepted
time: 1ms
memory: 3468kb

First Run Input

Alice
138808504

First Run Output

1222333333334444444466666666777779999

Second Run Input

Bob
4934763973366963677163362274693424444

Second Run Output

138808504

Manager to Checker

OK
Very Good!

result:

ok OK

Test #17:

score: 0
Wrong Answer
time: 1ms
memory: 3536kb

First Run Input

Alice
9871826654

First Run Output

0000000000000000000111111112222222333333444445555666778

Second Run Input


Second Run Output


Manager to Checker

WA
Wrong Answer on First Run: the length of your output exceeds the constraints(50).

result:

wrong answer WA