QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#270383 | #7809. 小苹果 | Tenshi | 100 ✓ | 0ms | 3692kb | C++20 | 770b | 2023-11-30 20:06:21 | 2023-11-30 20:06:23 |
Judging History
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;
}
Details
Tip: Click on the bar to expand more detailed information
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'