csp-j t1小苹果代码对吗
  • 板块学术版
  • 楼主cspwhp
  • 当前回复4
  • 已保存回复4
  • 发布时间2023/10/21 18:15
  • 上次更新2023/11/2 12:13:01
查看原帖
csp-j t1小苹果代码对吗
982594
cspwhp楼主2023/10/21 18:15
#include <bits/stdc++.h>
using namespace std;
int main(){
    //freopen("apple.in","r",stdin);
    //freopen("apple.out","w",stdout);
    int a,n,m,sum1=0,sum2=0;
    cin>>a;
    n=a;
    
    while(n!=0){
        sum1++;
        int t;
        if(n%3==0){
            t=n/3;
        }else{
            t=n/3+1;
        }
        n-=t;
        
    }
    m=a;
    while(1){
		sum2++;
		int t;
		if(m%3==1){
			break;
		}else if(m%3==2){
			t=m/3+1;
		}else{
			t=m/3;
		}
		m-=t;
	}
    cout<<sum1<<" "<<sum2;
    return 0;
}
2023/10/21 18:15
加载中...