PAT (Basic Level) Practice 1037 在霍格沃茨找零钱 (20 分)


题目:1037 在霍格沃茨找零钱 (20 分)

来源:PAT (Basic Level) Practice

传送门 1037 在霍格沃茨找零钱

题面

思路:字符串输入,for循环比较一遍即可。

Code

点击查看代码
#include 
using namespace std;
typedef long long ll;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	string a,b;
	cin>>a>>b;
	ll num1=0,ans1=0,num2=0,ans2=0,t1=0,t2=0;
	for(int i=0;ians2)cout<<"-";
	ans1 = max(ans1,ans2)-min(ans1,ans2);
	int k1 = ans1/17/29;
	int k2 = (ans1-17*29*k1)/29;
	int k3 = (ans1-17*29*k1) - 29*k2;
	cout<