Codeforces Round #249 (Div. 2) A. Black Square

水题

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
	vector<int> a(4);
	cin >> a[0] >> a[1]>>a[2]>>a[3];
	string str;
	cin >> str;
	int res = 0;
	for(int i = 0 ; i < str.length(); ++ i) res+=a[str[i]-‘0‘-1];
	cout<<res<<endl;

}

  

Codeforces Round #249 (Div. 2) A. Black Square,布布扣,bubuko.com

时间: 2024-08-13 01:02:34

Codeforces Round #249 (Div. 2) A. Black Square的相关文章

Codeforces Round #249 (Div. 2)-D

这场的c实在不想做,sad. D: 标记一下每一个点8个方向不经过黑点最多能到达多少个黑点. 由题意可知,三角形都是等腰三角形,那么我们就枚举三角形的顶点. 对于每一个定点,有8个方向可以放三角形. 然后枚举8个方向,然后枚举腰的长度.然后判断是否可行. #include <iostream> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <math.h>

Codeforces Round #249 (Div. 2) B. Pasha Maximizes

看到题目的时候,以为类似插入排序,比较第i个元素和第i-1个元素, 如果第i个元素比第i-1个元素小,则不交换 如果第i个元素比第i-1个元素大,则交换第i个元素和第i-1个元素 继续比较第i-1个元素与前一个元素,直到前一个元素大为止 交换元素次大于等于k则停止 但对测试用例 1234 3 则出现问题,如果按照上述方法得到答案为3214, 但正确答案是4321,直接将第4个元素往前交换 故在上面基础上改进得 当扫描第i个元素时,则要取出[i,i+k+1)之间的最大元素,然后将最大元素往前交换,

Codeforces Round #249 (Div. 2) (ABCD题解)

比赛链接:http://codeforces.com/contest/435 A. Queue on Bus Stop time limit per test:1 second memory limit per test:256 megabytes It's that time of the year when the Russians flood their countryside summer cottages (dachas) and the bus stop has a lot of p

Codeforces Round #599 (Div. 2) A. Maximum Square

Ujan decided to make a new wooden roof for the house. He has nn rectangular planks numbered from 11 to nn. The ii-th plank has size ai×1ai×1 (that is, the width is 11 and the height is aiai). Now, Ujan wants to make a square roof. He will first choos

Codeforces Round #249 (Div. 2)

A. Queue on Bus Stop 题目大意:有n组人乘车,每组人有a [ i ],每辆车可以载 m 个人,保证 a[ i ]小于m,每组人中的人都不能分开, 问,最少要几辆车. #include<bits/stdc++.h> using namespace std; int n,m,a[105]; int main() { cin>>n>>m; for(int i=1;i<=n;i++) scanf("%d",&a[i]); i

Codeforces Round #249 (Div. 2) A - Queue on Bus Stop

水题 ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 #include <iostream> #include <vector> #include <algorithm> using namespace std; int main(){     int n,m;     cin >> n >> m;     int cnt = 0, sum = 0;  

Codeforces Round #249 (Div. 2) A B

C好像就是个模拟,D 是个编码复杂度大的,但是好像也就是枚举三角形,我这会儿准备区域赛,尽量找点思维难度大的,所以昨晚A B 还是去做区域赛题吧..... B 也有点意思 贪心 题意:交换相邻两个位的数,然后最多换k次,求最大数 解法,找<=k范围内的最大数,与之交换,右移一位,继续找,直到k用完 //#pragma comment(linker, "/STACK:102400000,102400000") #include <cstdio> #include <

Codeforces Round #261 (Div. 2)459A. Pashmak and Garden(数学题)

题目链接:http://codeforces.com/problemset/problem/459/A A. Pashmak and Garden time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Pashmak has fallen in love with an attractive girl called Parmida s

Codeforces Round #279 (Div. 2) ABCD

Codeforces Round #279 (Div. 2) 做得我都变绿了! Problems # Name     A Team Olympiad standard input/output 1 s, 256 MB  x2377 B Queue standard input/output 2 s, 256 MB  x1250 C Hacking Cypher standard input/output 1 s, 256 MB  x740 D Chocolate standard input/