QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#563698 | #9285. Construct The Integer | zjy0001 | WA | 1ms | 3556kb | C++17 | 1.0kb | 2024-09-14 15:13:54 | 2024-09-14 15:13:55 |
Judging History
answer
#include<bits/stdc++.h>
#define LL long long
#define LLL __int128
#define uint unsigned
#define ldb long double
#define uLL unsigned long long
using namespace std;
map<LL,int>ans;
inline void init(){
vector<int>f(1000);
for(int x=0;x<10;++x)
for(int y=0;y<10;++y)
for(int z=0;z<10;++z)if(x||y||z)
f[x*100+y*10+z]=x*100+y*10+z,
f[x*100+y*10+z]=__gcd(f[x*100+y*10+z],x*100+z*10+y),
f[x*100+y*10+z]=__gcd(f[x*100+y*10+z],y*100+x*10+z),
f[x*100+y*10+z]=__gcd(f[x*100+y*10+z],y*100+z*10+x),
f[x*100+y*10+z]=__gcd(f[x*100+y*10+z],z*100+x*10+y),
f[x*100+y*10+z]=__gcd(f[x*100+y*10+z],z*100+y*10+x);
for(int i=1;i<1000;++i)
if(!ans.count(f[i]))ans[f[i]]=i;
else ans[f[i]]=min(ans[f[i]],i);
}
inline void MAIN(){
LL n;cin>>n;cout<<(ans.count(n)?ans[n]:-1)<<'\n';
}
signed main(){
cin.tie(0)->sync_with_stdio(0);
init();
int t=1;cin>>t;while(t--)MAIN();
return 0;
}
/*
*/
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3544kb
input:
2 12 2021
output:
48 -1
result:
ok 2 number(s): "48 -1"
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3556kb
input:
50 162281868021198482 843590795441798975 22222 149588437607469906 802011151087104980 6059547534408460 24 666666 2 76 29 44 6666666 333333 694875412087041404 203911016125660313 33333333333333333 621646568444724049 363434583954291856 33333333333333 7777777777777777 308242055812053607 65243634304254533...
output:
-1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 888 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 555 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
result:
wrong answer 3rd numbers differ - expected: '22222', found: '-1'