灵异事件!!!求调赏关!!!

P1618 三连击(升级版)

ShaunSH @ 2024-07-31 11:15:05

灵异事件!!!

测试数据#2下载了,本地是对的,交上去就错了。 https://www.luogu.com.cn/record/169629550

#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int a,b,c,x,m,n,l,o,z,y;
bool f,u[10];
int main(){
    scanf("%d%d%d",&a,&b,&c);
    if(a==0||b==0||c==0){
        printf("No!!!");
        return 0;
    }
    for(int i=1;i<=9;i++){
        for(int j=1;j<=9;j++){
            for(int k=1;k<=9;k++){
                for(int e=1;e<=9;e++)u[e]=0;
                if(i==j||j==k||i==k){
                    continue;
                }
                u[i]=1;
                u[j]=1;
                u[k]=1;
                x=i*100+j*10+k;
                y=1.0*x/a*b;
                m=y/100;
                y%=100;
                n=y/10;
                y%=10;
                l=y/1;
                y%=1;
                o=y;
                if(u[m]==0&&u[n]==0&&u[l]==0&&o==0&&m!=n&&n!=l&&l!=m&&m&&n&&l&&x<1000&&y<1000&&z<1000){
                    u[m]=1;
                    u[n]=1;
                    u[l]=1;
                    z=m*100+n*10+l;
                }
                else{
                    continue;
                }
                x=i*100+j*10+k;
                y=1.0*x/a*c;
                m=y/100;
                y%=100;
                n=y/10;
                y%=10;
                l=y/1;
                y%=1;
                o=y;
                y=m*100+n*10+l;
                if(u[m]==0&&u[n]==0&&u[l]==0&&o==0&&m!=n&&n!=l&&l!=m&&m&&n&&l&&x<1000&&y<1000&&z<1000){
                    f=1;
                    printf("%d %d %d\n",x,z,y);
                }
            }
        }
    }
    if(f==0){
        printf("No!!!");
    }
    return 0;
} 

by wangbird @ 2024-07-31 11:28:37

@ShaunSH 你能说说这个程序在干什么吗


by two_class_nds @ 2024-07-31 11:28:59

#2关了O2优化就能过


by two_class_nds @ 2024-07-31 11:32:25

关掉O2


by ShaunSH @ 2024-07-31 11:41:56

谢谢,关注了,@two_class_nds


|