题解 AT3879 【[ABC087A] Buying Sweets】
题解 AT3879 【[ABC087A] Buying Sweets】
本题考查基本输入输出与运算,但需要注意你会先买 一个 蛋糕,然后尽可能的多买甜甜圈。说明蛋糕数量是固定的,因此可得出
剩余钱数=(总钱数-蛋糕单价)%甜甜圈单价
上代码
#include<bits/stdc++.h>//头文件
using namespace std;
int x,a,b;//定义
int main(){
cin>>x>>a>>b//输入;
cout<<(x-a)%b;//按上文输出
return 0;
}