北京师范大学第十七届程序设计竞赛决赛 (重现赛) :-C 加油

昨天在群里看到一段话,讲的是每次打比赛都只能爆零或签到,,
(当然我觉得难度上…)
反正走是不可能的,
再菜我也要有个名次,赖在这里
我超喜欢这里的

北京师范大学第十七届程序设计竞赛决赛
A- 足球

时间限制:C/C++ 1秒,其他语言2秒
空间限制:C/C++ 131072K,其他语言262144K
64bit IO Format: %lld

题目描述

足球是世界第一大运动。
有人曾以这样的方式来评价一直球队的能力:
球队能力等于球队球员的总身价乘以该球队身价最低一人的身价。
现在已知每支球队都有 23 人,且球员的身价不超过 1000,不低于 1,
你需要求出每支球队的能力值。

输入描述:

第一行是一个正整数T (T <= 20),表示有T只队伍。
接下来T行,每行包含 23 个范围均不超过1000的正整数 ,表示一支球队所有队员的身价。

输出描述:

对每支球队输出一行,表示这支的能力值。

示例1
输入

1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

输出

23

#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<ctype.h>
#include<vector>
#include<map>
#include<set>
#include<queue> 
#include<iomanip>
#include<list>
#include<fstream>
using namespace std;
typedef long long ll;

int main(){
	int t;
	scanf("%d",&t);
	while(t--){
		int a[25] = {0};
		int sum = 0;
		for(int i=0;i<23;i++){
			scanf("%d",&a[i]);
			sum+=a[i];
		}
		sort(a,a+23);
		int ans = sum * a[0];
		printf("%d\n",ans);
	} 
	return 0;
}

B- 进制

时间限制:C/C++ 1秒,其他语言2秒
空间限制:C/C++ 131072K,其他语言262144K
64bit IO Format: %lld

题目描述

给一个长度不超过 18 的 01 串,你需要输出这个串在 2, 3, 4, 5, 6, 7, 8, 9, 10 进制表示下的数值在 10 进制下的和。

输入描述:

第一行是一个正整数 T (T<=100000),表示测试数据的组数,

接下来 T 行,每行包含一个长度不超过 18 的 01 串,保证没有前导零。

输出描述:

对于每组测试数据,输出一个整数。

示例1
输入

2
10
101

输出

54
393

大声BB

做这道题的时候我,,,,
我以为2-10进制的和时和2+3+…+9+10进制这个数相等的,
头脑简单,四肢还不发达
绝了

#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<ctype.h>
#include<vector>
#include<map>
#include<set>
#include<queue> 
#include<iomanip>
#include<list>
#include<fstream>
using namespace std;
typedef long long ll;
ll a;
ll s(int k){
	ll ans=0,m=1;
	ll  t = a;
	while(t != 0){
		ans = ans + (t % 10) * m;
		m = m * k;
		t = t / 10;
	}
	return ans;
}
int main(){
	int t;
	scanf("%d",&t);
	while(t--){
		ll sum = 0;
		scanf("%lld",&a);
		for(int i=2;i<=10;i++){
			sum = sum + s(i);
		}
		printf("%lld\n",sum);
	}
	return 0;
}

这里放一下选数字的思路

选数字
2019年05月12日 18:35:26 阿茶家的庸医 阅读数:90更多
个人分类: ACM
链接:https://blog.csdn.net/baidu_41671472/article/details/90143457

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值