题解 1072: 汽水瓶

来看看其他人写的题解吧!要先自己动手做才会有提高哦! 
返回题目 | 我来写题解

筛选

1072汽水瓶(递归算法实现)

摘要:解题思路:注意事项:参考代码:#include<stdio.h>int digui(int n,int* sum){ if(n<=1) return (*sum); else if(n==2) ret……

递归求解汽水瓶

摘要:解题思路:思路来源于母牛问题,递归的道理来解题将题目拆分成分段函数注意事项:两个瓶盖依旧可以喝一瓶,一个瓶盖就无法喝了,所以做好特殊类别的特殊对待,剩下都可以递归来考虑,虽然100个瓶盖也就是33+1……

按照题目思路解题

摘要:解题思路:注意事项:参考代码:void Calculate(int in) {    int drink = 0;    //记录累计喝下的汽水个数    int replace = 0;    //……

递归思想解题

摘要:解题思路:注意事项:参考代码:#include<iostream>using namespace std;int s=0;int F(int n){    if(n<2){        return……

汽水瓶:n/2

摘要:解题思路:注意事项:参考代码:#include<stdio.h>int main(){    int i=-1,j,n[100];    do{        scanf("%d",&n[++i]);……

用小学生思路解决此题

摘要:解题思路:枚举注意事项:参考代码:#include<stdio.h>int main(){ int a[10];int i=0,m=1;while(m){    scanf("%d",&a[i]); ……

while循环的简单使用

摘要:解题思路:注意事项:参考代码:#include <stdio.h>int x(int n) {    int sum = 0;    if (n < 2) return 0;     while (n……