100 Accepted
foo.cc: In function 'int xxx(int)': foo.cc:25:1: warning: control reaches end of non-void function [-Wreturn-type] 25 | } | ^
# | 状态 分数 | 耗时 | 内存占用 |
---|---|---|---|
#1 | Accepted 33 | 3ms | 412 KiB |
#2 | Accepted 33 | 3ms | 412 KiB |
#3 | Accepted 34 | 3ms | 412 KiB |
代码
#include<bits/stdc++.h>
using namespace std;
int s=0;
int xxx(int n)
{
int t1;
int t2;
if(n<=1)
{
return s;
}
if(n==2)
{
s+=1;
return s;
}
if(n>=3)
{
t1=n%3;
t2=n/3;
s+=t2;
t1+=t2;
xxx(t1);
}
}
int a;
int main()
{
while(cin>>a)
{
if(a==0)
{
break;
}
s=0;
cout<<xxx(a)<<endl;
}
return 0;
}
信息
- 递交者
- 题目
- P460 练83.2 汽水瓶
- 语言
- C++17
- 代码长度
- 484 Bytes
- 递交时间
- 2023-11-9 17:30:53
- 评测时间
- 2023-11-9 17:30:55
- 分数
- 100
- 总耗时
- 9ms
- 峰值时间
- 3ms
- 峰值内存
- 412 KiB