ZjfAKIOI @ 2024-07-18 09:00:19
和同学讨论了一下,感觉卡不掉? 求证明或 Hack
#include<bits/stdc++.h>
using namespace std;
bool vis[10];
int x,y,z;
double xy,yz;
bool check(int a,int b,int c){
double ab=1.0*a/b,bc=1.0*b/c;
if(abs(ab-xy)>1e-5||abs(bc-yz)>1e-5) return false;
memset(vis,false,sizeof(vis));
vis[a%10]=vis[b%10]=vis[c%10]=true;
a/=10,b/=10,c/=10;
vis[a%10]=vis[b%10]=vis[c%10]=true;
a/=10,b/=10,c/=10;
vis[a%10]=vis[b%10]=vis[c%10]=true;
for(int i=1;i<=9;i++) if(!vis[i]) return false;
return true;
}
int main(){
bool f=1;
cin>>x>>y>>z;
xy=1.0*x/y;
yz=1.0*y/z;
for(int i=123;i<=987;i++){
for(int j=234;j<=987;j++){
for(int k=345;k<=987;k++){
if(check(i,j,k)){
printf("%d %d %d\n",i,j,k);
f=0;
}
}
}
}
if(f) cout<<"No!!!";
return 0;
}
by wangqicheng1637 @ 2024-07-28 17:06:57
A了
by wangqicheng1637 @ 2024-07-28 17:07:26
[C:\Users\Dell\Desktop\途途笔记截图]
by 15339934200J @ 2024-07-30 19:48:44
你测试一下会死啊
by ZjfAKIOI @ 2024-10-06 20:15:21
@15339934200J 我又不是没测试过,你不会卡或者不会证明就别说话了