QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#270383#7809. 小苹果Tenshi100 ✓0ms3692kbC++20770b2023-11-30 20:06:212023-11-30 20:06:23

Judging History

This is the latest submission verdict.

  • [2023-11-30 20:06:23]
  • Judged
  • Verdict: 100
  • Time: 0ms
  • Memory: 3692kb
  • [2023-11-30 20:06:21]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;
 
#define debug(x) cerr << #x << ": " << (x) << endl
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define dwn(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define all(x) (x).begin(), (x).end()
 
#define x first
#define y second
using pii = pair<int, int>;
using ll = long long;
 
inline void read(int &x){
    int s=0; x=1;
    char ch=getchar();
    while(ch<'0' || ch>'9') {if(ch=='-')x=-1;ch=getchar();}
    while(ch>='0' && ch<='9') s=(s<<3)+(s<<1)+ch-'0',ch=getchar();
    x*=s;
}

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

signed main(){
	int n; cin>>n;
	int t=n, x=0;
	while(t){
		t-=(t-1)/3+1;
		x++;
	}
	cout<<x<<" "<<cal(n)<<endl;
	return 0;
}

详细

Test #1:

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

input:

5

output:

4 4

result:

ok single line: '4 4'

Test #2:

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

input:

8

output:

5 5

result:

ok single line: '5 5'

Test #3:

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

input:

713

output:

16 2

result:

ok single line: '16 2'

Test #4:

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

input:

799

output:

16 1

result:

ok single line: '16 1'

Test #5:

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

input:

747

output:

16 8

result:

ok single line: '16 8'

Test #6:

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

input:

779161

output:

33 1

result:

ok single line: '33 1'

Test #7:

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

input:

576262

output:

32 1

result:

ok single line: '32 1'

Test #8:

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

input:

782951

output:

33 4

result:

ok single line: '33 4'

Test #9:

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

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'