不知道哪里错了,求大佬解释
查看原帖
不知道哪里错了,求大佬解释
602243
Curryxs楼主2022/3/31 16:13
#include <bits/stdc++.h>
#define mem(ar,num) memset(ar,num,sizeof(ar))
#define me(ar) memset(ar,0,sizeof(ar))
#define lowbit(x) (x&(-x))
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
const int    prime = 999983;
const int    maxv=10000;
const int    INF = 0x7FFFFFFF;
const LL     INFF =0x7FFFFFFFFFFFFFFF;
const double pi = acos(-1.0);
const double inf = 1e18;
const double eps = 1e-6;
const LL     mod = 1e9 + 7;
int cnt;
int a[15];
int n,m,s;
int main()
{
	std::ios::sync_with_stdio(false);
	cin>>n>>m;
	while(n)
	{
		a[++cnt]=n%10;
		n/=10;
	}
	sort(a+1,a+1+cnt);
	int p,pp;
	for(int i=1;i<=cnt;i++)
	{
		if(a[i]!=0)
		{
			s=a[i];
			p=i;
			break;
		}
	}
	if(p!=1)
	s*=pow(10,p-1);
	for(int i=p+1;i<=cnt;i++)
	{
		s=(s*10+a[i]);
	}
	if(s==m) cout<<"OK"<<endl;
	else cout<<"WRONG_ANSWER"<<endl;
	return 0;
}
2022/3/31 16:13
加载中...