社区讨论
调不出来求调
P11229[CSP-J 2024] 小木棍参与者 2已保存回复 1
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 1 条
- 当前快照
- 1 份
- 快照标识符
- @m3a71co0
- 此快照首次捕获于
- 2024/11/09 21:20 去年
- 此快照最后确认于
- 2025/11/04 15:01 4 个月前
样例过了,一分不得QWQ
CPP#include<bits/stdc++.h>
using namespace std;
const int stk[11]={6,2,5,5,4,5,6,3,7,6};
int nms[100005];
int q,nm;
int onenm(int tp){//蒟蒻's马蜂过丑请见谅
if(tp>100000) return stk[tp/100000]+stk[(tp%=100000)/10000]+stk[(tp%=10000)/1000]+stk[(tp%=1000)/100]+stk[(tp%=100)/10]+stk[tp%=10];
else if(tp>10000) return stk[tp/10000]+stk[(tp%=10000)/1000]+stk[(tp%=1000)/100]+stk[(tp%=100)/10]+stk[tp%=10];
else if(tp>1000) return stk[tp/1000]+stk[(tp%=1000)/100]+stk[(tp%=100)/10]+stk[tp%=10];
else if(tp>100) return stk[tp/100]+stk[(tp%=100)/10]+stk[tp%=10];
else if(tp>10) return stk[tp/10]+stk[(tp%=10)];
return stk[tp];
}
void prew(){
for(int i=0;i<100001;i++){
int ned=0,tp=i;
ned+=onenm(tp);
nms[i]=ned;
}
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
prew();
cin>>q;
for(int i=0;i<q;i++){
bool fl=0;
cin>>nm;
for(int j=1;j<100001;j++){
if(nms[j]==nm) {
cout<<j<<endl;
fl=1;
break;
}
}
if(fl==0) cout<<"-1"<<endl;
}
return 0;
}
回复
共 1 条回复,欢迎继续交流。
正在加载回复...