8 条题解

  • 1
    @ 2025-2-16 10:06:30

    代码有点长,必须一步一步推

    #include<bits/stdc++.h>
    using namespace std;
    int main(){
        int a,b,c,d,e,f=0;
        cin>>a>>b>>c>>d>>e;
        f=a+b+c+d+e;
        b+=a/3;
        e+=a/3;
        a=a/3;
        a+=b/3;
        c+=b/3;
        b=b/3;
        b+=c/3;
        d+=c/3;
        c=c/3;
        c+=d/3;
        e+=d/3;
        d=d/3;
        d+=e/3;
        a+=e/3;
        e=e/3;
        f=f-a-b-c-d-e;
        cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e<<endl;
        cout<<f;
        return 0;
    }
    
    • 0
      @ 2025-9-17 21:40:28
      #include<iostream>
      using namespace std;
      int main(){
          int a,b,c,d,e,f;
          cin>>a>>b>>c>>d>>e;
          f=a%3;
      	a/=3;
          b+=a;
          e+=a;
          f=f+b%3;
      	b/=3;
          c+=b;
          a+=b;
          f=f+c%3;
      	c/=3;
          d+=c;
          b+=c;
          f=f+d%3;
      	d/=3;
          e+=d;
          c+=d;
          f=f+e%3;
      	e/=3;
          d+=e;
          a+=e;
          cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e<<endl;
          cout<<f;
      }
      
      
      • 0
        @ 2025-9-16 18:05:24
        #include<iostream>
        using namespace std;
        int main(){
            int a,b,c,d,e,f;
            cin>>a>>b>>c>>d>>e>>f;
            f=a+b+c+d+e;
            a=a/3;
            b=a+b;
            e=a+e;//1
            b=b/3;
            a=b+a;
            c=c+b;//2
            c=c/3;
            b=c+b;
            d=c+d;//3
            d=d/3;
            e=d+e;
            c=d+c;//4
            e=e/3;
            a=a+e;
            d=d+e;
            f=f-a-b-c-d-e;
            cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e<<endl;
            cout<<f;
            return 0;
        }
        
        • 0
          #include<bits/stdc++.h>
          using namespace std;
          int main(){
            int a,b,c,d,e,f;
          	cin>>a>>b>>c>>d>>e;
          	f=a+b+c+d+e;
          	a=a/3;
          	b=b+a;
          	e=e+a;//第一次分糖
          	b=b/3;
          	a=a+b;
          	c=c+b;//第二次分糖
              c=c/3;
          	b=b+c;
          	d=d+c;//第三次分糖
          	d=d/3;
          	c=c+d;
          	e=e+d;//第四次分糖 
          	e=e/3; 
          	a=a+e;
          	d=d+e;//第五次分糖 
          	f=f-a-b-c-d-e; 
          	cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e<<endl;
          	cout<<f;
          	return 0;
          }
          • -1
            @ 2025-2-15 11:38:16

            #include<bits/stdc++.h> using namespace std; int main(){ int a,b,c,d,e,f; cin>>a>>b>>c>>d>>e; f=a+b+c+d+e; a=a/3; b=b+a; e=e+a; b=b/3; a=a+b; c=c+b; c=c/3; b=b+c; d=d+c; d=d/3; c=c+d; e=e+d; e=e/3; a=a+e; d=d+e; f=f-a-b-c-d-e; cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e<<endl; cout<<f; return 0; }

            • -1

              #include<bits/stdc++.h> using namespace std; int a,b,c,d,e,x; int main() { cin>>a>>b>>c>>d>>e; x=a+b+c+d+e; a/=3; b+=a; e+=a; b/=3; a+=b; c+=b; c/=3; b+=c; d+=c; d/=3; c+=d; e+=d; e/=3; a+=e; d+=e; cout<<a<<' '<<b<<' '<<c<<' '<<d<<' '<<e<<endl; cout<<x-a-b-c-d-e<<endl;; return 0; }

              • -2
                @ 2024-12-5 12:58:24

                #include<bits/stdc++.h> using namespace std; int num[5],ans=0; int main(){ for(int i=0;i<5;i++) cin >> num[i]; for(int i=0;i<5;i++){ int t=num[i]/3; if(i0)num[4]+=t; else num[i-1]+=t; if(i4)num[0]+=t; else num[i+1]+=t; ans+=num[i]%3; num[i]=t; } for(int i=0;i<5;i++)cout << num[i] << " "; cout << endl << ans << endl;

                return 0;
                

                }

                • -2
                  @ 2024-12-5 12:57:50

                  #include<bits/stdc++.h> using namespace std; int num[5],ans=0; int main(){ for(int i=0;i<5;i++) cin >> num[i]; for(int i=0;i<5;i++){ int t=num[i]/3; if(i0)num[4]+=t; else num[i-1]+=t; if(i4)num[0]+=t; else num[i+1]+=t; ans+=num[i]%3; num[i]=t; } for(int i=0;i<5;i++)cout << num[i] << " "; cout << endl << ans << endl;

                  return 0;
                  

                  }

                  • 1

                  信息

                  ID
                  4470
                  时间
                  1000ms
                  内存
                  128MiB
                  难度
                  1
                  标签
                  (无)
                  递交数
                  340
                  已通过
                  152
                  上传者