|  | 
 
| 
x
马上注册,结交更多好友,享用更多功能^_^您需要 登录 才可以下载或查看,没有账号?立即注册  复制代码
/////差分模板//////
//  void insert(int x1,int y1,int x2,int y2,int c)
// {
//     b[x1][y1]+=c;
//     b[x2+1][y1]-=c;
//     b[x1][y2+1]-=c;
//     b[x2+1][y2+1]+=c;
// }
//  for(int i=1;i<=n;i++)
//     {
//         for(int j=1;j<=m;j++)
//         {
//             insert(i,j,i,j,a[i][j]);
            
//         }
//     }
//     while(q--)
//     {
//         int x1,y1,x2,y2,c;
//         cin>>x1>>y1>>x2>>y2>>c;
//         insert(x1,y1,x2,y2,c);
//     }
//     for(int i=1;i<=n;i++)
//         {
//             for(int j=1;j<=m;j++)
//             {
//                 b[i][j]+=b[i-1][j]+b[i][j-1]-b[i-1][j-1];
                
//             }
//         }
 //////////////////
 ///二维前缀和模板///
//  int x1,y1,x2,y2;
//         cin>>x1>>y1>>x2>>y2; //表示行号和列号
//         cout<<s[x2][y2]-s[x1-1][y2]-s[x2][y1-1]+s[x1-1][y1-1]<<endl;
//////////并查集模板///////
// int f[N];
// int find(int x)
// {
//     if(f[x]==x)return f[x];
//     f[x]=find(f[x]);
//     return f[x];
// }
// int main()
// {
//     int n,m; // m表示多少次询问(操作)
//     cin>>n>>m;
//     for(int i=1;i<=n;i++) f[i]=i;
//     while(m--)
//     {
//         char op;
//         int a,b;
//         cin>>op>>a>>b;
//         if(op=='M') //将两个集合进行合并
//         {
//             int fa=find(a),fb=find(b);
//             if(fa!=fb)f[fa]=fb;
//         }
//         else
//         {
//             if(find(a)==find(b))cout<<"yes"<<endl;
//             else cout<<"no"<<endl;
//         }
//     }
// }
#include <bits/stdc++.h>
using namespace std;
const int N=2e5+10;
typedef long long ll;
#define x first
#define y second
typedef pair<int,int>p;
int dx[]={-1,0,1,0},dy[]={0,-1,0,1}; //上左下右
void solve()
{
    int n,a,b;   // a为需要满足的水,b为马克杯的容量    
    int c=0,d=0;
    cin>>n>>a>>b;
    while(n--)
    {
        if(c==a)
        {
            c-=a;
        }
        else if(d==0)
        {
            d==b;
        }
        else
        {
            int ans=min(a-c,d);  //表示要减到多少
            c+=ans;
            d-=ans;
        }
    }
    cout<<c<<" "<<d<<endl;
     
}
int main()
{
    int t;
    t=1;
    while(t--)
    {
        solve();
    }
}
//开始值 0 0
// 0 200     c=0 , b=200     
// 100 100   a+=100, b-a=100
// 0   100   倒掉   
// 100  0
// 0   0  (这个要么为0要么就是满)  //此时又是一个循环
// c  d
// 0 500    //第三中情况
// 500-300 300  
//  ans=300   
// 300 200     c+a     d-a
//ans=200
// 2
// 0   200     c+ans     d-=ans
// 200  0   //此时不满足,所以不用
// 200  300      //第五次
// 300  200      // 第六次
// 0    200      //
 | 
 |