• 微信公众号：美女很有趣。 工作之余，放松一下，关注即送10G+美女照片！

# Codeforces Round #106 (Div. 2)

1周前 (04-29) 4次浏览

```#include<algorithm>
#include<iostream>
#include<cstring>
#include<cmath>
using namespace std;
int a[12];
int main(){
int k;
cin>>k;
int sum1=0,sum2=0;
for(int i=0;i<12;i++){
cin>>a[i];
sum1+=a[i];
}
if(sum1<k){
cout<<"-1"<<endl;
return 0;
}
if(k==0){
cout<<0<<endl;
return 0;
}
sort(a,a+12);
int cnt=0;
for(int i=12;i>=0;i--){
sum2+=a[i];
if(sum2>=k) break;
cnt++;
}
cout<<cnt<<endl;
return 0;
}```

# B – Martian Clock

```#include<algorithm>
#include<iostream>
#include<cstring>
#include<cmath>
#include<map>
using namespace std;
typedef long long ll;
int maxx=0;
ll change(string s,int x){
ll sum=0;
for(int i=s.length()-1;i>=0;i--){
if(s[i]>='A'&&s[i]<='Z'){
sum+=(s[i]-'A'+10)*pow(x,s.length()-i-1);
}else{
sum+=(s[i]-'0')*pow(x,s.length()-i-1);
}
}
return sum;
}
int main(){
string str,a,b;
cin>>str;
int flag=0,cnt=0,weizhi;
for(int i=0;i<str.length();i++){
if(str[i]>='A'&&str[i]<='Z'){
maxx=max(maxx,str[i]-'A'+10);
}else if(str[i]!=':'){
maxx=max(maxx,str[i]-'0');
}
if(str[i]!='0'&&str[i]!=':') cnt++;
if(str[i]==':'){
weizhi=i;
flag=1;
continue;
}
if(!flag){
a+=str[i];
}else{
b+=str[i];
}
}
int flag1=0;
if((cnt==2&&str[weizhi-1]!='0'&&str[str.length()-1]!='0')||
(cnt==1&&(str[weizhi-1]!='0'||str[str.length()-1]!='0'))||cnt==0){
if(str[weizhi-1]>='O'&&str[weizhi-1]<='Z'){
cout<<0<<endl;
}else{
cout<<-1<<endl;
}
return 0;
}else{
for(int i=maxx+1;;i++){
int t1,t2;
t1=change(a,i),t2=change(b,i);
if(t1>=0&&t1<=23&&t2>=0&&t2<=59){
if(i==maxx+1){
cout<<i;
}else{
cout<<" "<<i;
}
}else{
break;
}
flag1=1;
}
if(!flag1){
cout<<0<<endl;
}else{
cout<<endl;
}
return 0;
}
return 0;
}```

# C – Division into Teams

```#include<algorithm>
#include<iostream>
#include<cstring>
#include<cmath>
#include<map>
using namespace std;
typedef long long ll;
struct node{
int num;
int weizhi;
}a[100010];
bool cmp(node x,node y){
return x.num>y.num;
}
int main(){
int n;
cin>>n;
for(int i=0;i<n;i++){
cin>>a[i].num;
a[i].weizhi=i+1;
}
sort(a,a+n,cmp);
cout<<(n+1)/2<<endl;
for(int i=0;i<n;i+=2){
cout<<a[i].weizhi<<" ";
}
cout<<endl;
cout<<n-(n+1)/2<<endl;
for(int i=1;i<n;i+=2){
cout<<a[i].weizhi<<" ";
}
cout<<endl;
return 0;
}```