10 条题解
- 1
信息
- ID
- 2235
- 时间
- 1000ms
- 内存
- 512MiB
- 难度
- 7
- 标签
- 递交数
- 335
- 已通过
- 76
- 上传者
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,day1=0,day2=0;
cin>>n;
while(n){
day1++;
if(n%3==1 and day2==0){
day2=day1;
}
n=n-ceil(1.0*n/3);
}
cout<<day1<<" "<<day2;
return 0;
}
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,d1=0,d2=0,i;
cin>>n;
for(i=1;1;i++){
d1++;
if(n%3==1 and d2==0){
d2=d1;
}
if(n%3==0)n=n-n/3;
else n=n-(n/3+1);
if(n==0) break;
}
cout<<d1<<" "<<d2;
return 0;
}
#include using namespace std; int a,flag,pick; long long x; int main() { cin>>a; while(a) {
x++;
int t=1+(a-1)/3;
if((a-1)%3==0&&pick==0){
pick=x;
}
a-=t;
}
cout<<x<<' '<<pick;
return 0;
}
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,i=1,cnt=0,sum=0;
cin>>n;
while(1)
{
if(n==0) break;
if(!cnt && n%3==1) cnt=i;
n-=ceil(n/3.0);//要用到的函数
++sum;
++i;
}
cout<<sum<<" "<<cnt;
return 0;
}
#include<bits/stdc++.h>
using namespace std;
int n,d,b;
int main(){
cin>>n;
while(n){
d++;
if(n%3==1&&b==0)b=d;
n=n-ceil(1.0*n/3);
}
cout<<d<<" "<<b;
}
#include <bits/stdc++.h> using namespace std; int n,ans2; void f(int day) { if(!ans2 && n % 3 == 1) ans2 = day + 1; if(n == 0) { cout << day << " " << ans2; return; } n -= ceil(n * 1.0 / 3); f(day + 1); return; } int main() { cin >> n; f(0); return 0; }
#include<bits/stdc++.h> using namespace std; int main(){ int n,day1=0,day2=0; cin>>n; for(int i=1;1;i++){ day1++; //n第几天拿走 if(n%31 and day20){ day2=day1; } //第几天拿完 if(n%30) n=n-n/3; else n=n-(n/3+1); if(n0) break; } cout<<day1<<" "<<day2; return 0; }
#include<iostream>
using namespace std;
int a,flag,pick;
long long x;
int main()
{
cin>>a;
while(a)
{
x++;
int t=1+(a-1)/3;
if((a-1)%3==0&&pick==0){
pick=x;
}
a-=t;
}
cout<<x<<' '<<pick;
return 0;
}
#include <bits/stdc++.h> using namespace std; int n,cnt,ans; int main(){ cin>>n; int sum=0; while(n>0){ cnt++; if(n%30){ sum=n/3; } else sum=ceil((double)n/3); if(n%31&& ans==0) ans=cnt;n-=sum; } cout<<cnt<<" "<<ans; return 0; }