QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#450364#7809. 小苹果Tiger_Rory100 ✓0ms3680kbC++14539b2024-06-22 11:00:292024-06-22 11:00:33

Judging History

This is the latest submission verdict.

  • [2024-06-22 11:00:33]
  • Judged
  • Verdict: 100
  • Time: 0ms
  • Memory: 3680kb
  • [2024-06-22 11:00:29]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std; 

int main()
{
    int n; 
    cin >> n; 
    int a = n, b = n, sum = 0, cnt = 0, d = 0; 
    while(a > 0)
    {
        sum = 0; 
        sum += a / 3;
        if(a % 3 != 0) sum++; 
        a -= sum; 
        b -= sum; 
        cnt++; 
        if(b % 3 == 1 && b > 0)
        {
            d = cnt + 1; 
            b = 0; 
        }
    }
    cout << cnt << " "; 
    if(n % 3 == 1) cout << "1" << endl; 
    else
    {
        cout << d; 
    }
    return 0; 
}

详细

Test #1:

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

input:

5

output:

4 4

result:

ok single line: '4 4'

Test #2:

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

input:

8

output:

5 5

result:

ok single line: '5 5'

Test #3:

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

input:

713

output:

16 2

result:

ok single line: '16 2'

Test #4:

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

input:

799

output:

16 1

result:

ok single line: '16 1'

Test #5:

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

input:

747

output:

16 8

result:

ok single line: '16 8'

Test #6:

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

input:

779161

output:

33 1

result:

ok single line: '33 1'

Test #7:

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

input:

576262

output:

32 1

result:

ok single line: '32 1'

Test #8:

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

input:

782951

output:

33 4

result:

ok single line: '33 4'

Test #9:

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

input:

551877

output:

32 2

result:

ok single line: '32 2'

Test #10:

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

input:

926023422

output:

50 4

result:

ok single line: '50 4'