QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#556236#4664. Broken ConnectionWorld_Creater0 1ms3788kbC++20730b2024-09-10 16:10:052024-09-10 16:10:05

Judging History

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

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

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);
		}
		cout<<ans;
	}
	if(s=="Bob")
	{
		string s;
		cin>>s;
		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: 3608kb

First Run Input

Alice
2022

First Run Output

668899

Second Run Input

Bob
688996

Second Run Output

2022

Manager to Checker

OK
Very Good!

result:

ok OK

Test #2:

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

First Run Input

Alice
20060411

First Run Output

22555555777789

Second Run Input

Bob
77579558255275

Second Run Output

20060411

Manager to Checker

OK
Very Good!

result:

ok OK

Test #3:

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

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: 3776kb

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: 3528kb

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: 3740kb

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: 3600kb

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: 3608kb

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: 3788kb

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: 3604kb

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: 0ms
memory: 3600kb

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: 3712kb

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: 0ms
memory: 3772kb

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: 0
Instance #1 Time Limit Exceeded

First Run Input

Alice
0

First Run Output


Second Run Input

Bob


Second Run Output


Manager to Checker

WA
Wrong Answer on Second Run: failed to read your output

result: