日志12

#include<bits/stdc++.h>
using namespace std;
int c1,m1,c2,m2,c3,m3;
void c1toc2(){
    int tem=c2-m2;
    if(m1>=tem){
        m1-=tem;
        m2=c2;
    }else{
        m2+=m1;
        m1=0;
    }
}
void c2toc3(){ 
    int tem=c3-m3;
    if(m2>=tem){
        m3=c3;
        m2-=tem;
    }else{
         m3+=m2;
        m2=0;
    }   
}   
void c3toc1(){
    int tem=c1-m1;
    if(m3>=tem){
        m1=c1;
        m3-=tem;
    }else{ 
        m1+=m3;
        m3=0;
    }
}
    int main(){
    int numb=0;
    cin>>c1>>m1>>c2>>m2>>c3>>m3;
    while(1){ 
 c1toc2();   
   numb++; 
if(numb>=100)break;
 c2toc3();
   numb++;
        if(numb>=100)break;
        c3toc1();
        numb++;
        if(numb>=100)break;
    }
cout<<m1<<endl;
cout<<m2<<endl;
    cout<<m3<<endl;
    }

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务