QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#259134#7809. 小苹果supepapupu100 ✓0ms3700kbC++17676b2023-11-20 17:04:102023-11-20 17:04:11

Judging History

This is the latest submission verdict.

  • [2023-11-20 17:04:11]
  • Judged
  • Verdict: 100
  • Time: 0ms
  • Memory: 3700kb
  • [2023-11-20 17:04:10]
  • Submitted

answer

#include <bits/stdc++.h>

#define x first
#define y second
#define el '\n'
#define debug(x) cout << #x << ": " << x << el
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int N = 3e5 + 10, INF = 0x3f3f3f3f, mod = 998244353;

int wk(int n) {
    if (n % 3 == 1) return 1;
    return wk(n - (n + 2) / 3) + 1;
}

int main() {
    // freopen("apple.in", "r", stdin);
    // freopen("apple.out", "w", stdout);
    ios::sync_with_stdio(0); cin.tie(0);
    int n; cin >> n;
    int k = n, ans = 0;
    while (k) {
        k -= (k + 2) / 3;
        ++ans;
    }
    cout << ans << ' ' << wk(n) << el;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5

output:

4 4

result:

ok single line: '4 4'

Test #2:

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

input:

8

output:

5 5

result:

ok single line: '5 5'

Test #3:

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

input:

713

output:

16 2

result:

ok single line: '16 2'

Test #4:

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

input:

799

output:

16 1

result:

ok single line: '16 1'

Test #5:

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

input:

747

output:

16 8

result:

ok single line: '16 8'

Test #6:

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

input:

779161

output:

33 1

result:

ok single line: '33 1'

Test #7:

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

input:

576262

output:

32 1

result:

ok single line: '32 1'

Test #8:

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

input:

782951

output:

33 4

result:

ok single line: '33 4'

Test #9:

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

input:

551877

output:

32 2

result:

ok single line: '32 2'

Test #10:

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

input:

926023422

output:

50 4

result:

ok single line: '50 4'