help
2024-07-16 18:01:05
发布于:广东
58阅读
0回复
0点赞
#include <bits/stdc++.h>
using namespace std;
int main()
{
freopen("test.in","n",stdin);
freopen("test.in","w",stdout);
int n;
cin >> n;
int cnt=n;
int ans1=0,ans2=-1;
while (cnt!=0){
++ans1;
int t=ceil(cnt/3.0);
if (ans2==-1 && cnt%3==1){
ans2=ans1;
}
cnt-=t;
}
cout<<ans1<<" "<<ans2<<endl;
fclose(stdin);
fclose(stdout);
return 0;
}
全部评论 3
#include <bits/stdc++.h> using namespace std; int main() { freopen("apple.in","r",stdin); freopen("apple.out","w",stdout); int n; cin >> n; int cnt=n; int ans1=0,ans2=-1; while (cnt!=0){ ++ans1; int t=ceil(cnt/3.0); if (ans2==-1 && cnt%3==1){ ans2=ans1; } cnt-=t; } cout<<ans1<<" "<<ans2<<endl; fclose(stdin); fclose(stdout); return 0; }
2024-07-30 来自 广东
0apple.in
apple.out2024-07-19 来自 广东
0ding
2024-07-16 来自 广东
0
有帮助,赞一个