一直编译到现在......问问代码问题
查看原帖
一直编译到现在......问问代码问题
541221
GYansec楼主2022/1/24 20:22

编译器上对了,这边还没编译出来。。

#include<bits/stdc++.h>  
using namespace std;
int remove(int x){
	int a[100],len=0;
	while(x>0){
		if(x%10==0){
			a[len]=x%100/10;
			x/=100;
		}else{
			a[len]=x%10;
			x/=10;
		}
		len++;
	}
	int ans=0,cnt=1;
	for(int i=0;i<len;i++){
		ans+=a[i]*cnt;
		cnt*=10;
	}
	return ans; 
}
int main() {
	int a,b;
	cin>>a>>b;
	if(remove(a)+remove(b)==remove(a+b)){
		cout<<"YES";
	}else{
		cout<<"NO";
	}
	return 0;
}
2022/1/24 20:22
加载中...