15 条题解

  • 1
    @ 2026-5-23 10:52:06

    #include using namespace std; int main() { int n,nn = 0,ans = 0; cin >> n; while (true) { ans += n; nn += n; n = nn / 3; nn -= n * 3; if (n == 0) break; } cout << ans; return 0; }

    //容易理解的写法

    • 1
      @ 2025-11-16 21:43:17

      #include using namespace std; int main() { int N; cin >> N; int total = N;
      int bottles = N;
      while (bottles >= 3) { int new_cola = bottles / 3;
      total += new_cola;
      bottles = bottles % 3 + new_cola; }
      cout << total << endl; return 0; }

      • 0
        @ 2025-12-21 13:29:53
        #include <iostream>
        using namespace std;
        int main()
        {
        	int n,nn = 0,ans = 0;
        	cin >> n;
        	while (true)
        	{
        		ans += n;
        		nn += n;
        		n = nn / 3;
        		nn -= n * 3;
        		if (n == 0)
        			break;
        	}
        	cout << ans;
        	return 0;
        }
        //容易理解的写法
        • 0
          @ 2025-11-23 20:04:11

          #include<bits/stdc++.h> using namespace std; int a,k,ans; int main() { cin>>a; ans = a; k = a; while(k>=3){ ans+=k/3; k = k%3+k/3; } cout<<ans; return 0; }

          • 0
            @ 2024-11-29 21:48:41
            #include <bits/stdc++.h>
            using namespace std;
            int a,k,ans;
            int main()
            {
            	cin>>a;
            	ans = a;
            	k = a;
            	while(k>=3){
            	ans+=k/3;
            	k = k%3+k/3;
            	}
            	cout<<ans;
            	return 0;
            }
            
            • 0
              @ 2022-1-11 9:28:11
              #include <math.h>
              #include <stack>
              #include <stdio.h>
              #include <iostream>
              #include <vector>
              #include <iomanip>
              #include <string.h>
              #include <algorithm>
              using namespace std;
              #define LL long long
              const int N = 1e5 + 10;
              const int INF = 0x3f3f3f3f;
              int main()
              {
                  int n , sum = 0 ,k = 0;
                  cin >> n;
                  sum = n;
                  while(n >= 3)
                  {
                      sum +=n/3;
                      n = n/3 +n%3;
                  }
                  cout<<sum<<endl;
              }
              
              • -2
                @ 2025-5-27 13:22:13

                #include using namespace std; int maxcola(int n) { int empty = n; int total = n; while(empty >= 3) { int newcola = empty / 3; total += newcola;
                empty = empty % 3 + newcola; } return total; } int main() { int n; cin >> n; cout << maxcola(n); return 0;
                }

                • -2
                  @ 2025-3-1 20:13:14

                  #include <math.h> #include #include <stdio.h> #include #include #include #include <string.h> #include using namespace std; #define LL long long const int N = 1e5 + 10; const int INF = 0x3f3f3f3f; int main() { int n , sum = 0 ,k = 0; cin >> n; sum = n; while(n >= 3) { sum +=n/3; n = n/3 +n%3; } cout<<sum<<endl; }

                  • -2
                    @ 2022-7-9 10:25:54

                    /crl(陈儒乐)/

                    #include<bits/stdc++.h>//网上查到的万能头//

                    using namespace std;

                    int main()

                    {

                    int n;
                    
                    cin >> n;
                    
                    int ans = n;
                    
                    int k = n;
                    
                    while(k >= 3)
                    
                    {
                    
                        ans += k/3;
                    
                        k = k%3 + k/3;
                    
                    }
                    
                    cout << ans << endl;
                    
                    return 0;
                    

                    }

                    • -2
                      @ 2022-1-11 9:26:24
                      #include<iostream>
                      #include<stdio.h>
                      #include <math.h>
                      using namespace std;
                      int main()
                      {
                          int n , sum = 0 ,k = 0;
                          cin >> n;
                          sum = n;
                          while(n >= 3)
                          {
                              sum +=n/3;
                              n = n/3 +n%3;
                          }
                          cout<<sum<<endl;
                      }
                      
                      • -3
                        @ 2024-3-19 16:55:56
                        #include <iostraem>
                        using namespace std;
                        int main()
                        {
                        	int a, z;
                        	cin>>a>>z;
                        	if (a>= 10 && z >= 20 )
                        ```
                        ```
                        {
                        	cout<<1;
                        }
                        else
                        {
                        	cout<<0;
                        }
                        return 0;
                        ```
                        
                        }
                        
                        ```
                        我就看谁傻傻地直接超题解
                        ```
                        
                        ```
                        
                        ```
                        
                        • -3
                          @ 2023-11-5 21:48:37

                          #include using namespace std; const int N=1e2+10; const int INF=0x3f3f3f3f; int a,b,n; int main(){ cin>>n; b=n; while(n>=3) { a=n/3; n=n%3+a; b+=a; } cout<<b; return 0; }

                          • -3
                            @ 2022-1-11 9:29:17
                            #include <iostream>
                            #include <math.h>
                            using namespace std;
                            int main()
                            {
                            	int n,sum=0,k=0;
                            	cin>>n;
                            	sum=n;
                            	while(n>=3)
                            	{
                            		sum+=n/3;
                            		n=n/3+n%3;
                            	}
                            	cout<<sum<<endl;
                            }
                            
                            • -3
                              @ 2022-1-11 9:24:40
                              #include <iostream>
                              #include <math.h>
                              using namespace std;
                              int main()
                              {
                                  int n,sum = 0,k = 0;
                                  cin >> n;
                                  sum = n;
                                  while(n >= 3)
                                  {
                                      sum += n/3;
                                      n=n/3+n%3;
                                  }
                                  cout<<sum<<endl;
                              }
                              
                              • -4
                                @ 2022-1-11 9:23:37
                                #include <iostream>
                                #include <math.h>
                                using namespace std;
                                int main()
                                {
                                	int n,sum=0,k=0;
                                	cin>>n;
                                	sum=n;
                                	while(n>=3)
                                	{
                                		sum+=n/3;
                                		n=n/3+n%3;
                                	}
                                	cout<<sum<<endl;
                                }
                                
                                • 1

                                信息

                                ID
                                914
                                时间
                                1000ms
                                内存
                                128MiB
                                难度
                                5
                                标签
                                递交数
                                1177
                                已通过
                                430
                                上传者