QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#590055#7809. 小苹果LittleYoo#100 ✓1ms3716kbC++20391b2024-09-25 21:16:182024-09-25 21:16:19

Judging History

This is the latest submission verdict.

  • [2024-09-25 21:16:19]
  • Judged
  • Verdict: 100
  • Time: 1ms
  • Memory: 3716kb
  • [2024-09-25 21:16:18]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
void solve()
{
	int n;
	cin >> n;
	int ans = 0, cnt = 0, ans2;
	bool f = 0;
	while(n) {
		++cnt;
		if(!f && n % 3 == 1) {
			ans2 = cnt;
			f = 1;
		}
		n -= (n + 2) / 3;
	}
	cout << cnt << ' ' << ans2 << '\n';
}

signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	solve();
	return 0;
}

详细


Pretests


Final Tests

Test #1:

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

input:

5

output:

4 4

result:

ok single line: '4 4'

Test #2:

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

input:

8

output:

5 5

result:

ok single line: '5 5'

Test #3:

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

input:

713

output:

16 2

result:

ok single line: '16 2'

Test #4:

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

input:

799

output:

16 1

result:

ok single line: '16 1'

Test #5:

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

input:

747

output:

16 8

result:

ok single line: '16 8'

Test #6:

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

input:

779161

output:

33 1

result:

ok single line: '33 1'

Test #7:

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

input:

576262

output:

32 1

result:

ok single line: '32 1'

Test #8:

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

input:

782951

output:

33 4

result:

ok single line: '33 4'

Test #9:

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

input:

551877

output:

32 2

result:

ok single line: '32 2'

Test #10:

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

input:

926023422

output:

50 4

result:

ok single line: '50 4'