QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#325102#5611. Pea PatternYuukiS#AC ✓1ms3824kbC++201.1kb2024-02-11 04:15:492024-02-11 04:15:49

Judging History

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

  • [2024-02-11 04:15:49]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3824kb
  • [2024-02-11 04:15:49]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;

void solve() {
    string N, S; cin >> N >> S;
    unordered_set<string> s;
    for(int i = 1; i <= 100; i++) {
        string newN = "";
        if(N == S) {
            cout << i << "\n";
            return;
        }
        vi cnt(10, 0);
        for(char c : N) {
            cnt[c - '0']++;
        }
        for(int j = 0; j < 10; j++) {
            if(!cnt[j]) continue;
            string inter = "";
            while(cnt[j]) {
                inter += (char) (cnt[j] % 10 + '0');
                cnt[j] /= 10;
            }
            reverse(inter.begin(), inter.end());
            newN += inter;
            newN += (char) (j + '0');
        }
        if(s.find(newN) != s.end()) {
            cout << "Does not appear" << "\n";
            return;
        }
        s.insert(newN);
        N = newN;
    }
    cout << "I'm bored" << "\n";
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int T = 1;
    // cin >> T;
    while(T--) {
        solve();
    }
    return 0;
}

详细

Test #1:

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

input:

1 3112

output:

5

result:

ok 2 lines

Test #2:

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

input:

1 3113

output:

Does not appear

result:

ok single line: 'Does not appear'

Test #3:

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

input:

20902 101011213141516171829

output:

10

result:

ok 4 lines

Test #4:

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

input:

2 21322314

output:

12

result:

ok single line: '12'

Test #5:

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

input:

22 22

output:

1

result:

ok single line: '1'

Test #6:

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

input:

22 33

output:

Does not appear

result:

ok single line: 'Does not appear'

Test #7:

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

input:

333 33

output:

2

result:

ok single line: '2'

Test #8:

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

input:

9999 211419

output:

4

result:

ok single line: '4'

Test #9:

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

input:

333 1223

output:

Does not appear

result:

ok single line: 'Does not appear'

Test #10:

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

input:

6213072339984041715643598373129685095950286197476593963450583775091057772824097115773957027804820066 10713223141516271819

output:

7

result:

ok single line: '7'

Test #11:

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

input:

6213072339984041715643598373129685095950286197476593963450583775091057772824097115773957027804820066 1208182103741258615788129

output:

2

result:

ok single line: '2'

Test #12:

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

input:

6213072339984041715643598373129685095950286197476593963450583775091057772824097115773957027804820066 20614213142516275819

output:

3

result:

ok single line: '3'

Test #13:

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

input:

6213072339984041715643598373129685095950286197476593963450583775091057772824097115773957027804820066 10514213242526171819

output:

4

result:

ok single line: '4'

Test #14:

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

input:

6213072339984041715643598373129685095950286197476593963450583775091057772824097115773957027804820066 10614213242516171819

output:

5

result:

ok single line: '5'

Test #15:

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

input:

6213072339984041715643598373129685095950286197476593963450583775091057772824097115773957027804820066 10713213241526171819

output:

6

result:

ok single line: '6'

Test #16:

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

input:

5760796952721030527278419404639297379512004745656907470181522830868116262767424456581793673894349233 10713223141516271819

output:

6

result:

ok single line: '6'

Test #17:

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

input:

897678784374340160231039448528219712620866946899496660815136811148469916897741818868299053445426618 10713223141516271819

output:

7

result:

ok single line: '7'

Test #18:

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

input:

9875522794707419324430013746923858126255632154419782774579265023442974920822006101275880435247510060 10714213141516172819

output:

8

result:

ok single line: '8'

Test #19:

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

input:

6450693110528174834676741623815633485834476548762068362094803360834377278209448667844309615098419492 10713223141516271819

output:

7

result:

ok single line: '7'

Test #20:

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

input:

1246572628123573053789690513071002843435336323527730608568174181981461742226632907509019080661386908 13011111213364851269710879

output:

2

result:

ok single line: '2'

Test #21:

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

input:

1246572628123573053789690513071002843435336323527730608568174181981461742226632907509019080661386908 10713223141516271819

output:

5

result:

ok single line: '5'

Test #22:

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

input:

90101102103114959697118129 40912213141516171859

output:

2

result:

ok single line: '2'

Test #23:

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

input:

10714213141516172819 6029399657344115253051082941972061881465048310877211053695083920702601184950742779905215660394516864

output:

Does not appear

result:

ok single line: 'Does not appear'

Test #24:

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

input:

6029399657344115253051082941972061881465048310877211053695083920702601184950742779905215660394516864 10714213141516172819

output:

8

result:

ok single line: '8'

Test #25:

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

input:

6029399657344115253051082941972061881465048310877211053695083920702601184950742779905215660394516864 10714213141516172818

output:

Does not appear

result:

ok single line: 'Does not appear'

Test #26:

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

input:

1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 1001

output:

2

result:

ok single line: '2'

Test #27:

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

input:

1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 103112233

output:

Does not appear

result:

ok single line: 'Does not appear'

Test #28:

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

input:

1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 9

output:

Does not appear

result:

ok single line: 'Does not appear'