求助,一直WA
查看原帖
求助,一直WA
261417
asasas楼主2021/8/16 18:01
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define r register
bool a[15];
int main(){
    int n,pwq=0;
    while(cin >> n&&n){
    	bool qwqq=0;
    	if (pwq++) cout << endl;
    	for (register int i=2*12345;i<=98765;i++){
    		memset(a,0,sizeof(a));
    		if (i%n==0){
    			int qwq=i/n;
    			int now=i;
    			if (1234<=qwq<=10000) a[0]=1;
    			else continue ;
    			while(qwq){
    				a[qwq%10]=1;
    				qwq/=10;
    			}
    			while(now){
    				a[now%10]=1;
    				now/=10;
    			}
    			bool ok=0;
    			for (register int i=0;i<=9;i++) if (a[i]==0) ok=1;
    			if (ok==0){
    				if (i/n<10000)
				    printf("%d / 0%d = %d\n",i,i/n,n); 
				    else printf("%d / %d = %d\n",i,i/n,n); 
				    qwqq=1;
//				    break;
				}
    		}
    	}
    	if (qwqq==0) printf("There are no solutions for %d.\n",n);
    }
    return 0;
}
2021/8/16 18:01
加载中...