QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#357929#6821. Another A+B Problemcrsfaa#AC ✓4ms4212kbC++141.3kb2024-03-19 15:10:092024-03-19 15:10:10

Judging History

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

  • [2024-03-19 15:10:10]
  • 评测
  • 测评结果:AC
  • 用时:4ms
  • 内存:4212kb
  • [2024-03-19 15:10:09]
  • 提交

answer

#include<bits/stdc++.h>
#define Yukinoshita namespace
#define Yukino std
using Yukinoshita Yukino;
int read()
{
	int s=0,w=1;
	char ch=getchar();
	while(ch<'0'||ch>'9') w=ch=='-'?-1:1,ch=getchar();
	while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
	return s*w;
}
vector<string> ans;
int qwq[100],cnt[100],cr[100];
string tos(int x)
{
	if(x<10) return "0"+to_string(x);
	return to_string(x);
}
int main()
{	
	memset(cr,127,sizeof(cr));
	vector<int> w{0,1,3,4,6,7};
	string e,c;
	cin>>e>>c;
	for(auto i:w)
	{
		if(c[i]=='G')
			qwq[i]=e[i];
		else qwq[i]=-e[i];
		if(c[i]=='P'||c[i]=='G')
			cnt[e[i]-'0']++;
	}
	for(auto i:w)
	{
		if(c[i]=='B')
			cr[e[i]-'0']=cnt[e[i]-'0'];
	}
	vector<string> ans;
	int i,j,k,l;
	for(i=0;i<100;i++)
		for(j=0;j<100;j++)
			for(k=0;k<100;k++)
				if(i+j==k)
				{
					string a=tos(i),b=tos(j),c=tos(k);
					string t=a+"+"+b+"="+c;
	//				cout<<t<<endl;
					int ccnt[10]={0};
					for(auto i:w)
					{
						if(qwq[i]>0&&qwq[i]!=t[i]||qwq[i]<0&&-qwq[i]==t[i])
							goto bre;
						ccnt[t[i]-'0']++;
					}
	//				cout<<t<<endl;
					for(l=0;l<10;l++)
						if(ccnt[l]<cnt[l]||ccnt[l]>cr[l])
							goto bre;
					ans.push_back(t);
					bre:;
				}
	printf("%d\n",ans.size());
	for(auto x:ans)
		cout<<x<<endl;
}
/*
12+46=58
GBGGPGGB

14+42=56
*/

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

40+11=51
PBGPPGGB

output:

7
11+42=53
11+43=54
11+44=55
11+45=56
11+46=57
11+47=58
11+48=59

result:

ok ans=7

Test #2:

score: 0
Accepted
time: 1ms
memory: 4032kb

input:

12+46=58
GBGGPGGB

output:

6
11+45=56
13+43=56
15+41=56
16+40=56
16+41=57
16+43=59

result:

ok ans=6

Test #3:

score: 0
Accepted
time: 1ms
memory: 3660kb

input:

11+22=33
PBGPPGGP

output:

1
22+13=35

result:

ok ans=1

Test #4:

score: 0
Accepted
time: 1ms
memory: 4084kb

input:

11+22=33
BPGPPGGP

output:

1
22+13=35

result:

ok ans=1

Test #5:

score: 0
Accepted
time: 1ms
memory: 3844kb

input:

01+02=03
PPGPPGPP

output:

2
10+20=30
20+10=30

result:

ok ans=2

Test #6:

score: 0
Accepted
time: 4ms
memory: 4212kb

input:

00+00=00
BBGBBGBB

output:

2304
11+11=22
11+12=23
11+13=24
11+14=25
11+15=26
11+16=27
11+17=28
11+18=29
11+21=32
11+22=33
11+23=34
11+24=35
11+25=36
11+26=37
11+27=38
11+28=39
11+31=42
11+32=43
11+33=44
11+34=45
11+35=46
11+36=47
11+37=48
11+38=49
11+41=52
11+42=53
11+43=54
11+44=55
11+45=56
11+46=57
11+47=58
11+48=59
11+51=6...

result:

ok ans=2304

Test #7:

score: 0
Accepted
time: 0ms
memory: 3840kb

input:

44+44=88
BBGBBGBB

output:

1441
00+00=00
00+01=01
00+02=02
00+03=03
00+05=05
00+06=06
00+07=07
00+09=09
00+10=10
00+11=11
00+12=12
00+13=13
00+15=15
00+16=16
00+17=17
00+19=19
00+20=20
00+21=21
00+22=22
00+23=23
00+25=25
00+26=26
00+27=27
00+29=29
00+30=30
00+31=31
00+32=32
00+33=33
00+35=35
00+36=36
00+37=37
00+39=39
00+50=5...

result:

ok ans=1441

Test #8:

score: 0
Accepted
time: 1ms
memory: 3656kb

input:

23+45=68
GGGGGGGG

output:

1
23+45=68

result:

ok ans=1

Test #9:

score: 0
Accepted
time: 1ms
memory: 3960kb

input:

09+71=80
GBGBBGBG

output:

18
00+00=00
00+20=20
00+30=30
00+40=40
00+50=50
00+60=60
04+26=30
04+36=40
04+46=50
04+56=60
05+25=30
05+35=40
05+45=50
05+55=60
06+24=30
06+34=40
06+44=50
06+54=60

result:

ok ans=18

Test #10:

score: 0
Accepted
time: 1ms
memory: 3776kb

input:

37+52=89
BPGBPGPP

output:

34
08+19=27
09+18=27
12+78=90
14+78=92
18+09=27
18+29=47
18+74=92
19+08=27
19+28=47
20+78=98
21+77=98
22+76=98
24+74=98
28+19=47
28+49=77
28+69=97
28+70=98
29+18=47
29+48=77
29+49=78
29+68=97
48+29=77
49+28=77
49+29=78
68+29=97
69+28=97
70+28=98
71+27=98
72+18=90
72+26=98
74+18=92
74+24=98
78+14=92
...

result:

ok ans=34

Test #11:

score: 0
Accepted
time: 1ms
memory: 3672kb

input:

57+26=83
PBGGPGBP

output:

18
06+25=31
06+29=35
11+25=36
15+21=36
31+25=56
32+24=56
33+23=56
34+22=56
35+21=56
35+25=60
35+29=64
36+20=56
36+23=59
36+25=61
36+29=65
39+25=64
42+23=65
43+22=65

result:

ok ans=18

Test #12:

score: 0
Accepted
time: 1ms
memory: 3772kb

input:

41+11=52
PPGBBGBB

output:

98
03+38=41
04+06=10
04+09=13
04+37=41
04+67=71
04+77=81
04+87=91
06+04=10
06+08=14
07+07=14
07+34=41
07+64=71
07+74=81
07+84=91
08+06=14
08+33=41
09+04=13
10+30=40
10+33=43
10+34=44
10+36=46
10+37=47
10+38=48
10+39=49
10+64=74
10+74=84
10+84=94
13+30=43
13+33=46
13+34=47
13+36=49
13+47=60
13+64=77
...

result:

ok ans=98

Test #13:

score: 0
Accepted
time: 1ms
memory: 3776kb

input:

08+41=49
PPGBPGBB

output:

76
10+08=18
10+18=28
10+28=38
10+58=68
10+68=78
10+70=80
10+72=82
10+73=83
10+75=85
10+76=86
10+77=87
10+78=88
11+07=18
11+70=81
12+06=18
12+08=20
12+18=30
12+38=50
12+58=70
12+68=80
12+70=82
13+05=18
13+08=21
13+67=80
13+70=83
15+03=18
15+08=23
15+65=80
15+70=85
16+02=18
16+70=86
17+08=25
17+63=80
...

result:

ok ans=76

Test #14:

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

input:

30+28=58
BPGPBGPB

output:

82
02+05=07
02+15=17
02+45=47
02+59=61
02+65=67
02+75=77
02+95=97
05+02=07
05+07=12
05+12=17
05+15=20
05+16=21
05+17=22
05+19=24
05+42=47
05+57=62
05+62=67
05+67=72
05+72=77
05+92=97
06+15=21
06+19=25
06+56=62
07+05=12
07+15=22
07+55=62
07+65=72
09+15=24
09+16=25
09+52=61
12+05=17
12+50=62
15+02=17
...

result:

ok ans=82

Test #15:

score: 0
Accepted
time: 1ms
memory: 3776kb

input:

14+04=18
BGGBPGBB

output:

24
24+22=46
24+23=47
24+25=49
24+42=66
24+43=67
24+45=69
24+49=73
34+42=76
34+43=77
34+45=79
44+22=66
44+23=67
44+25=69
44+29=73
44+32=76
44+33=77
44+35=79
44+49=93
44+52=96
44+53=97
44+55=99
54+42=96
54+43=97
54+45=99

result:

ok ans=24

Test #16:

score: 0
Accepted
time: 1ms
memory: 3676kb

input:

48+35=83
BBGPBGBB

output:

144
01+29=30
02+29=31
03+06=09
03+07=10
03+09=12
03+16=19
03+17=20
03+19=22
03+26=29
03+66=69
03+67=70
03+69=72
03+76=79
03+96=99
06+03=09
06+13=19
06+23=29
06+26=32
06+63=69
06+73=79
06+93=99
07+03=10
07+13=20
07+29=36
07+63=70
09+03=12
09+13=22
09+21=30
09+22=31
09+27=36
09+63=72
10+20=30
10+21=31...

result:

ok ans=144

Test #17:

score: 0
Accepted
time: 1ms
memory: 3844kb

input:

29+61=90
BPGBGGBB

output:

11
18+31=49
18+41=59
18+71=89
38+11=49
38+41=79
38+51=89
48+11=59
48+31=79
48+41=89
58+31=89
78+11=89

result:

ok ans=11

Test #18:

score: 0
Accepted
time: 0ms
memory: 3968kb

input:

32+29=61
BBGBBGBP

output:

136
00+10=10
00+14=14
00+15=15
00+17=17
00+18=18
01+04=05
01+07=08
01+14=15
01+17=18
01+44=45
01+47=48
01+54=55
01+57=58
01+74=75
01+77=78
01+84=85
01+87=88
04+01=05
04+10=14
04+11=15
04+14=18
04+41=45
04+51=55
04+71=75
04+81=85
05+05=10
05+10=15
07+01=08
07+07=14
07+08=15
07+10=17
07+11=18
07+41=48...

result:

ok ans=136

Test #19:

score: 0
Accepted
time: 1ms
memory: 3776kb

input:

38+16=54
BPGBPGPG

output:

4
06+58=64
26+58=84
56+08=64
56+28=84

result:

ok ans=4

Test #20:

score: 0
Accepted
time: 1ms
memory: 3956kb

input:

72+11=83
GBGBBGGB

output:

18
74+06=80
75+05=80
75+09=84
76+04=80
76+08=84
76+09=85
77+07=84
77+08=85
77+09=86
78+06=84
78+07=85
78+08=86
78+09=87
79+05=84
79+06=85
79+07=86
79+08=87
79+09=88

result:

ok ans=18

Test #21:

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

input:

42+36=78
PBGPBGPP

output:

35
03+84=87
04+79=83
04+83=87
09+74=83
11+73=84
13+71=84
13+74=87
13+84=97
14+73=87
14+83=97
33+47=80
33+54=87
34+47=81
34+53=87
37+08=45
37+43=80
37+44=81
37+47=84
37+48=85
38+07=45
38+09=47
38+47=85
38+49=87
39+08=47
39+48=87
71+13=84
73+11=84
73+14=87
74+09=83
74+13=87
79+04=83
83+04=87
83+14=97
...

result:

ok ans=35

Test #22:

score: 0
Accepted
time: 1ms
memory: 3668kb

input:

29+44=73
BBGBBGPB

output:

122
00+07=07
00+17=17
00+57=57
00+67=67
00+87=87
01+06=07
01+07=08
01+16=17
01+17=18
01+56=57
01+57=58
01+66=67
01+67=68
01+86=87
01+87=88
05+75=80
05+76=81
06+01=07
06+11=17
06+51=57
06+61=67
06+75=81
06+81=87
07+00=07
07+01=08
07+08=15
07+10=17
07+11=18
07+50=57
07+51=58
07+58=65
07+60=67
07+61=68...

result:

ok ans=122

Test #23:

score: 0
Accepted
time: 1ms
memory: 3772kb

input:

41+01=42
PBGGBGBB

output:

64
03+04=07
04+03=07
04+05=09
05+04=09
33+04=37
34+03=37
34+05=39
35+04=39
53+04=57
54+03=57
54+05=59
54+06=60
54+09=63
55+04=59
55+09=64
56+04=60
56+08=64
57+07=64
58+06=64
59+04=63
59+05=64
63+04=67
64+03=67
64+05=69
64+06=70
64+09=73
65+04=69
65+09=74
66+04=70
66+08=74
67+07=74
68+06=74
69+04=73
...

result:

ok ans=64

Test #24:

score: 0
Accepted
time: 1ms
memory: 3672kb

input:

51+44=95
BPGPBGGB

output:

32
03+91=94
04+87=91
12+82=94
13+81=94
14+76=90
14+77=91
14+78=92
14+79=93
14+82=96
14+83=97
16+78=94
17+77=94
18+76=94
23+71=94
24+67=91
33+61=94
63+31=94
64+27=91
73+21=94
74+16=90
74+17=91
74+18=92
74+19=93
76+18=94
77+17=94
78+16=94
82+12=94
83+11=94
84+07=91
84+12=96
84+13=97
93+01=94

result:

ok ans=32

Test #25:

score: 0
Accepted
time: 1ms
memory: 4028kb

input:

21+67=88
GGGBPGBB

output:

11
21+49=70
21+50=71
21+51=72
21+52=73
21+53=74
21+54=75
21+70=91
21+71=92
21+72=93
21+73=94
21+74=95

result:

ok ans=11

Test #26:

score: 0
Accepted
time: 1ms
memory: 3964kb

input:

45+33=78
BBGPBGPB

output:

55
03+07=10
03+17=20
06+07=13
06+17=23
07+06=13
07+16=23
07+29=36
09+27=36
10+27=37
11+26=37
12+27=39
13+07=20
13+77=90
13+79=92
16+07=23
16+21=37
16+77=93
17+06=23
17+19=36
17+20=37
17+22=39
17+76=93
19+17=36
20+17=37
21+16=37
21+72=93
22+17=39
22+71=93
23+67=90
23+76=99
26+11=37
26+67=93
27+09=36
...

result:

ok ans=55

Test #27:

score: 0
Accepted
time: 1ms
memory: 3664kb

input:

09+69=78
BPGPBGBP

output:

50
11+58=69
11+85=96
12+84=96
13+83=96
14+82=96
15+81=96
18+51=69
21+48=69
28+41=69
31+38=69
33+56=89
36+53=89
36+58=94
38+31=69
38+56=94
38+58=96
41+28=69
43+46=89
46+43=89
46+48=94
48+21=69
48+46=94
48+48=96
51+18=69
53+36=89
56+33=89
56+38=94
58+11=69
58+36=94
58+38=96
61+28=89
63+26=89
63+28=91
...

result:

ok ans=50

Test #28:

score: 0
Accepted
time: 1ms
memory: 3960kb

input:

11+39=50
BPGPBGGP

output:

10
02+51=53
03+48=51
03+51=54
08+43=51
40+13=53
43+08=51
43+10=53
48+03=51
52+01=53
53+01=54

result:

ok ans=10

Test #29:

score: 0
Accepted
time: 2ms
memory: 3956kb

input:

39+00=39
BBGBBGBB

output:

484
11+11=22
11+14=25
11+15=26
11+16=27
11+17=28
11+41=52
11+44=55
11+45=56
11+46=57
11+47=58
11+51=62
11+54=65
11+55=66
11+56=67
11+57=68
11+61=72
11+64=75
11+65=76
11+66=77
11+67=78
11+71=82
11+74=85
11+75=86
11+76=87
11+77=88
12+12=24
12+14=26
12+15=27
12+16=28
12+42=54
12+44=56
12+45=57
12+46=58...

result:

ok ans=484

Test #30:

score: 0
Accepted
time: 0ms
memory: 3716kb

input:

74+23=97
BBGBPGGG

output:

8
31+66=97
36+61=97
38+59=97
39+58=97
58+39=97
59+38=97
61+36=97
66+31=97

result:

ok ans=8

Test #31:

score: 0
Accepted
time: 1ms
memory: 3968kb

input:

36+05=41
BBGBPGPB

output:

46
22+52=74
24+28=52
24+54=78
24+58=82
25+29=54
25+47=72
25+49=74
25+54=79
25+59=84
25+74=99
27+27=54
27+48=75
27+57=84
28+24=52
28+47=75
28+54=82
42+52=94
42+57=99
44+54=98
45+27=72
45+29=74
45+42=87
45+44=89
45+47=92
45+49=94
45+52=97
45+54=99
47+28=75
47+48=95
47+52=99
48+27=75
48+47=95
52+22=74
...

result:

ok ans=46

Test #32:

score: 0
Accepted
time: 1ms
memory: 4088kb

input:

08+32=40
GBGBBGPB

output:

41
01+14=15
01+54=55
01+64=65
01+74=75
01+94=95
04+11=15
04+15=19
04+47=51
04+51=55
04+55=59
04+57=61
04+61=65
04+65=69
04+67=71
04+71=75
04+75=79
04+91=95
04+95=99
05+14=19
05+46=51
05+49=54
05+54=59
05+59=64
05+64=69
05+69=74
05+74=79
05+94=99
06+45=51
06+49=55
07+44=51
07+47=54
07+49=56
07+54=61
...

result:

ok ans=41

Test #33:

score: 0
Accepted
time: 1ms
memory: 3660kb

input:

73+11=84
BPGGBGBB

output:

21
09+13=22
20+10=30
20+12=32
20+13=33
20+15=35
20+16=36
20+19=39
22+10=32
22+13=35
25+10=35
26+10=36
26+13=39
29+10=39
35+15=50
36+16=52
36+19=55
39+13=52
39+16=55
50+13=63
52+13=65
56+13=69

result:

ok ans=21

Test #34:

score: 0
Accepted
time: 0ms
memory: 3720kb

input:

39+21=60
PBGPPGPB

output:

26
11+62=73
12+34=46
12+36=48
12+63=75
13+13=26
13+62=75
14+32=46
16+16=32
16+32=48
16+36=52
21+15=36
21+16=37
21+35=56
21+36=57
21+62=83
21+63=84
22+14=36
22+16=38
23+13=36
24+12=36
26+12=38
26+17=43
27+16=43
61+12=73
62+13=75
63+12=75

result:

ok ans=26

Test #35:

score: 0
Accepted
time: 0ms
memory: 3792kb

input:

50+33=83
PPGBBGBB

output:

312
01+04=05
01+05=06
01+14=15
01+15=16
01+24=25
01+25=26
01+44=45
01+45=46
01+49=50
01+50=51
01+51=52
01+54=55
01+55=56
01+56=57
01+59=60
01+64=65
01+65=66
01+74=75
01+75=76
01+94=95
01+95=96
02+05=07
02+15=17
02+25=27
02+45=47
02+49=51
02+50=52
02+52=54
02+54=56
02+55=57
02+57=59
02+59=61
02+65=67...

result:

ok ans=312

Test #36:

score: 0
Accepted
time: 1ms
memory: 3848kb

input:

24+51=75
BPGBBGPB

output:

78
00+47=47
03+04=07
03+34=37
03+37=40
03+44=47
03+64=67
03+84=87
03+94=97
06+37=43
06+74=80
06+78=84
07+33=40
07+36=43
07+37=44
07+39=46
07+40=47
07+77=84
07+87=94
08+39=47
08+76=84
09+37=46
09+38=47
09+74=83
33+04=37
33+07=40
33+34=67
33+47=80
33+64=97
36+07=43
36+47=83
37+03=40
37+06=43
37+07=44
...

result:

ok ans=78

Test #37:

score: 0
Accepted
time: 1ms
memory: 4084kb

input:

36+48=84
BGGPBGBP

output:

7
16+24=40
26+14=40
46+00=46
46+01=47
46+04=50
46+14=60
46+24=70

result:

ok ans=7

Test #38:

score: 0
Accepted
time: 1ms
memory: 3764kb

input:

04+46=50
BPGBPGGG

output:

3
16+34=50
26+24=50
36+14=50

result:

ok ans=3

Test #39:

score: 0
Accepted
time: 1ms
memory: 3700kb

input:

18+52=70
PBGPPGGB

output:

22
25+46=71
26+45=71
45+26=71
46+25=71
51+21=72
51+23=74
51+24=75
51+25=76
51+26=77
52+19=71
52+21=73
53+19=72
53+21=74
54+21=75
55+17=72
55+21=76
56+16=72
56+21=77
57+15=72
59+13=72
62+13=75
62+15=77

result:

ok ans=22

Test #40:

score: 0
Accepted
time: 1ms
memory: 4092kb

input:

50+26=76
PPGBBGPB

output:

61
01+57=58
03+47=50
03+54=57
04+47=51
04+53=57
05+75=80
05+78=83
05+79=84
07+08=15
07+38=45
07+43=50
07+44=51
07+47=54
07+48=55
07+50=57
07+51=58
07+78=85
07+88=95
08+07=15
08+37=45
08+47=55
08+49=57
08+75=83
08+77=85
08+87=95
09+48=57
09+75=84
13+37=50
15+70=85
15+75=90
17+33=50
17+40=57
33+17=50
...

result:

ok ans=61

Test #41:

score: 0
Accepted
time: 1ms
memory: 3664kb

input:

03+29=32
BBGPBGBP

output:

37
12+12=24
12+14=26
12+15=27
12+16=28
12+42=54
12+52=64
12+62=74
12+72=84
14+12=26
15+12=27
16+12=28
22+42=64
22+44=66
22+45=67
22+46=68
22+52=74
22+54=76
22+55=77
22+56=78
22+62=84
22+64=86
22+65=87
22+66=88
24+42=66
24+52=76
24+62=86
25+42=67
25+52=77
25+62=87
26+42=68
26+52=78
26+62=88
42+12=54
...

result:

ok ans=37

Test #42:

score: 0
Accepted
time: 0ms
memory: 4092kb

input:

24+22=46
BGGBBGPB

output:

83
04+00=04
04+04=08
04+10=14
04+14=18
04+30=34
04+34=38
04+47=51
04+49=53
04+50=54
04+54=58
04+70=74
04+74=78
04+80=84
04+84=88
04+90=94
04+94=98
14+00=14
14+04=18
14+40=54
14+41=55
14+43=57
14+44=58
14+45=59
14+70=84
14+74=88
14+80=94
14+84=98
34+00=34
34+04=38
34+40=74
34+41=75
34+43=77
34+44=78
...

result:

ok ans=83

Test #43:

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

input:

49+13=62
GPGBPGBB

output:

14
40+39=79
43+47=90
43+50=93
43+54=97
43+55=98
44+09=53
44+35=79
44+39=83
44+49=93
45+34=79
45+39=84
45+48=93
48+39=87
48+45=93

result:

ok ans=14

Test #44:

score: 0
Accepted
time: 1ms
memory: 3644kb

input:

45+51=96
GBGBBGBP

output:

37
40+20=60
40+22=62
40+23=63
40+24=64
40+27=67
40+28=68
42+06=48
42+20=62
42+22=64
42+26=68
42+36=78
42+46=88
43+20=63
43+24=67
44+20=64
44+23=67
44+24=68
44+26=70
44+36=80
46+02=48
46+22=68
46+24=70
46+26=72
46+27=73
46+28=74
46+32=78
46+34=80
46+36=82
46+37=83
46+38=84
46+42=88
47+20=67
47+26=73
...

result:

ok ans=37

Test #45:

score: 0
Accepted
time: 1ms
memory: 3776kb

input:

70+24=94
BPGPPGBP

output:

24
01+41=42
01+42=43
02+40=42
02+41=43
02+43=45
02+46=48
03+42=45
04+38=42
04+42=46
04+48=52
06+42=48
24+16=40
34+08=42
41+01=42
41+02=43
42+00=42
42+01=43
42+03=45
42+06=48
42+40=82
43+02=45
44+02=46
44+08=52
46+02=48

result:

ok ans=24

Test #46:

score: 0
Accepted
time: 1ms
memory: 3660kb

input:

65+14=79
BPGGPGBG

output:

10
04+15=19
14+15=29
24+15=39
34+15=49
40+19=59
41+18=59
44+15=59
48+11=59
49+10=59
84+15=99

result:

ok ans=10

Test #47:

score: 0
Accepted
time: 1ms
memory: 3924kb

input:

28+54=82
GPGBBGBB

output:

15
21+17=38
21+18=39
21+77=98
21+78=99
23+08=31
23+38=61
23+68=91
27+11=38
27+71=98
29+08=37
29+09=38
29+38=67
29+39=68
29+68=97
29+69=98

result:

ok ans=15

Test #48:

score: 0
Accepted
time: 1ms
memory: 3672kb

input:

60+19=79
BPGBBGBB

output:

208
02+00=02
02+02=04
02+03=05
02+20=22
02+22=24
02+23=25
02+28=30
02+30=32
02+32=34
02+33=35
02+38=40
02+40=42
02+42=44
02+43=45
02+48=50
02+50=52
02+52=54
02+53=55
02+80=82
02+82=84
02+83=85
03+00=03
03+02=05
03+05=08
03+20=23
03+22=25
03+25=28
03+30=33
03+32=35
03+35=38
03+40=43
03+42=45
03+45=48...

result:

ok ans=208

Test #49:

score: 0
Accepted
time: 1ms
memory: 3664kb

input:

25+61=86
BBGPGGPB

output:

8
16+81=97
37+31=68
38+31=69
67+11=78
67+31=98
68+11=79
68+31=99
86+11=97

result:

ok ans=8

Test #50:

score: 0
Accepted
time: 1ms
memory: 3660kb

input:

45+41=86
BBGBPGGG

output:

12
10+76=86
13+73=86
16+70=86
17+69=86
18+68=86
19+67=86
67+19=86
68+18=86
69+17=86
70+16=86
73+13=86
76+10=86

result:

ok ans=12

Test #51:

score: 0
Accepted
time: 1ms
memory: 3972kb

input:

08+23=31
BBGPGGPB

output:

16
22+33=55
23+33=56
23+43=66
23+53=76
23+73=96
24+33=57
26+33=59
29+33=62
32+33=65
32+43=75
32+63=95
39+33=72
39+53=92
42+33=75
59+33=92
62+33=95

result:

ok ans=16

Test #52:

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

input:

68+20=88
PBGBBGBB

output:

249
11+35=46
11+36=47
11+45=56
11+46=57
11+53=64
11+54=65
11+55=66
11+56=67
11+63=74
11+64=75
11+65=76
11+66=77
13+33=46
13+36=49
13+43=56
13+46=59
13+51=64
13+53=66
13+54=67
13+56=69
13+61=74
13+63=76
13+64=77
13+66=79
14+47=61
14+49=63
14+51=65
14+53=67
14+55=69
14+61=75
14+63=77
14+65=79
15+16=31...

result:

ok ans=249

Test #53:

score: 0
Accepted
time: 1ms
memory: 3660kb

input:

23+75=98
PBGPPGGB

output:

17
05+92=97
42+57=99
45+47=92
45+52=97
47+52=99
52+47=99
55+42=97
57+42=99
65+27=92
71+24=95
74+21=95
75+17=92
75+20=95
75+21=96
75+22=97
75+24=99
95+02=97

result:

ok ans=17

Test #54:

score: 0
Accepted
time: 1ms
memory: 4032kb

input:

50+48=98
PBGBBGGB

output:

63
15+76=91
15+77=92
16+75=91
16+79=95
17+75=92
19+76=95
21+75=96
22+73=95
22+75=97
23+72=95
25+66=91
25+67=92
25+71=96
25+72=97
26+65=91
26+69=95
27+65=92
29+66=95
31+65=96
32+59=91
32+63=95
32+65=97
33+59=92
33+62=95
35+56=91
35+57=92
35+61=96
35+62=97
36+55=91
36+56=92
36+57=93
36+59=95
37+55=92
...

result:

ok ans=63

Test #55:

score: 0
Accepted
time: 0ms
memory: 3772kb

input:

16+74=90
GBGGBGGB

output:

15
12+79=91
13+78=91
13+79=92
15+77=92
15+78=93
17+75=92
17+78=95
18+73=91
18+75=93
18+77=95
18+79=97
19+72=91
19+73=92
19+78=97
19+79=98

result:

ok ans=15

Test #56:

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

input:

54+00=54
BGGBBGPB

output:

47
14+11=25
14+15=29
14+21=35
14+25=39
14+52=66
14+53=67
14+57=71
14+58=72
14+59=73
14+61=75
14+65=79
14+71=85
14+75=89
14+81=95
14+85=99
24+11=35
24+15=39
24+52=76
24+53=77
24+57=81
24+58=82
24+59=83
24+61=85
24+65=89
24+71=95
24+75=99
34+31=65
34+35=69
34+52=86
34+53=87
34+57=91
34+58=92
34+59=93
...

result:

ok ans=47

Test #57:

score: 0
Accepted
time: 0ms
memory: 3836kb

input:

01+85=86
PPGPGGBB

output:

3
13+05=18
18+05=23
80+15=95

result:

ok ans=3

Test #58:

score: 0
Accepted
time: 1ms
memory: 3672kb

input:

64+32=96
BBGGPGBB

output:

36
01+31=32
02+30=32
02+31=33
02+33=35
02+35=37
12+38=50
15+37=52
17+35=52
20+30=50
20+31=51
20+33=53
20+35=55
20+37=57
20+38=58
21+30=51
21+31=52
21+37=58
22+30=52
22+31=53
22+33=55
22+35=57
23+30=53
23+35=58
25+30=55
25+33=58
27+30=57
27+31=58
28+30=58
32+38=70
35+37=72
37+35=72
51+31=82
52+30=82
...

result:

ok ans=36

Test #59:

score: 0
Accepted
time: 1ms
memory: 3664kb

input:

10+35=45
BGGPPGBB

output:

16
20+53=73
30+20=50
30+22=52
30+23=53
30+26=56
30+27=57
30+28=58
30+29=59
30+50=80
30+52=82
30+53=83
30+56=86
30+57=87
30+58=88
30+59=89
50+23=73

result:

ok ans=16

Test #60:

score: 0
Accepted
time: 1ms
memory: 3652kb

input:

15+59=74
GBGBBGBB

output:

69
10+00=10
10+01=11
10+02=12
10+03=13
10+06=16
10+08=18
10+10=20
10+11=21
10+12=22
10+13=23
10+16=26
10+18=28
10+20=30
10+21=31
10+22=32
10+23=33
10+26=36
10+28=38
11+00=11
11+01=12
11+02=13
11+10=21
11+11=22
11+12=23
11+20=31
11+21=32
11+22=33
12+00=12
12+01=13
12+06=18
12+08=20
12+10=22
12+11=23
...

result:

ok ans=69

Test #61:

score: 0
Accepted
time: 0ms
memory: 4032kb

input:

04+53=57
BPGBBGBB

output:

90
12+12=24
12+14=26
12+29=41
12+49=61
12+82=94
12+84=96
16+26=42
16+28=44
16+46=62
16+48=64
16+68=84
18+24=42
18+26=44
18+28=46
18+44=62
18+46=64
18+48=66
18+64=82
18+66=84
19+22=41
19+29=48
19+42=61
19+49=68
21+21=42
21+28=49
21+41=62
21+48=69
22+19=41
22+22=44
22+24=46
22+26=48
22+42=64
22+44=66
...

result:

ok ans=90

Test #62:

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

input:

00+48=48
PPGBPGBB

output:

14
18+02=20
28+02=30
58+02=60
68+02=70
71+09=80
73+07=80
75+05=80
77+03=80
79+01=80
81+09=90
83+07=90
85+05=90
87+03=90
89+01=90

result:

ok ans=14

Test #63:

score: 0
Accepted
time: 1ms
memory: 4088kb

input:

19+53=72
PBGPPGBP

output:

54
03+12=15
05+18=23
05+26=31
06+25=31
08+15=23
20+15=35
20+31=51
21+14=35
21+15=36
21+30=51
21+32=53
21+34=55
21+35=56
22+31=53
23+12=35
23+15=38
23+28=51
23+31=54
24+11=35
24+31=55
25+06=31
25+10=35
25+11=36
25+18=43
25+31=56
25+36=61
26+05=31
26+35=61
28+15=43
30+21=51
31+20=51
31+22=53
31+24=55
...

result:

ok ans=54

Test #64:

score: 0
Accepted
time: 1ms
memory: 3664kb

input:

54+37=91
PPGPBGBB

output:

40
02+43=45
03+42=45
03+45=48
05+43=48
05+48=53
08+45=53
22+23=45
22+43=65
23+22=45
23+25=48
23+42=65
23+45=68
25+23=48
25+43=68
30+24=54
30+54=84
32+22=54
32+24=56
32+52=84
32+54=86
35+05=40
35+08=43
35+45=80
35+48=83
38+05=43
38+45=83
42+03=45
42+23=65
42+43=85
43+02=45
43+05=48
43+22=65
43+25=68
...

result:

ok ans=40

Test #65:

score: 0
Accepted
time: 1ms
memory: 3776kb

input:

09+23=32
PBGBPGGB

output:

27
13+17=30
30+00=30
30+01=31
30+04=34
30+05=35
30+06=36
30+07=37
30+08=38
31+00=31
31+04=35
31+05=36
31+06=37
31+07=38
33+00=33
33+01=34
33+04=37
33+05=38
34+00=34
34+01=35
34+04=38
35+00=35
35+01=36
36+00=36
36+01=37
37+00=37
37+01=38
38+00=38

result:

ok ans=27