Codeforces Round #251 (Div. 2) A - Devu, the Singer and Churu, the Joker

水题


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

using namespace std;

int main(){
int n,d,t;
cin >> n >> d;
for(int i = 0 ; i < n; ++ i){
cin >> t;
d-=t;
}
d-=(n-1)*10;
if(d < 0) cout<<-1<<endl;
else cout<<(n-1)*2+d/5<<endl;
}

Codeforces Round #251 (Div. 2) A - Devu, the Singer and Churu,
the Joker

时间: 2024-08-20 00:13:55

Codeforces Round #251 (Div. 2) A - Devu, the Singer and Churu, the Joker的相关文章

Codeforces Round #251 (Div. 2) C. Devu and Partitioning of the Array

注意p的边界情况,p为0,或者 p为k 奇数+偶数 = 奇数 奇数+奇数 = 偶数 #include <iostream> #include <vector> #include <set> #include <algorithm> #include <cmath> using namespace std; int main(){ int n,k,p; long a; cin >> n >> k >> p; ve

Codeforces Round #251 (Div. 2) B. Devu, the Dumb Guy

注意数据范围即可 #include <iostream> #include <vector> #include <algorithm> using namespace std; int main(){ long long n,x; cin >> n >> x; vector<long long> c(n); for(int i = 0 ; i < n; ++ i) cin >> c[i]; sort(c.begin(

*Codeforces Round #251 (Div. 2)AK)

A.确定性数学计算,水,读题要快 1 #include<iostream> 2 #include<stdio.h> 3 4 using namespace std; 5 int N,d; 6 int main(){ 7 while(~scanf("%d%d",&N,&d)){ 8 int cnt=0; 9 for(int i=0;i<N;i++){ 10 int t; 11 scanf("%d",&t); 12

Codeforces Round #251 (Div. 2) C、D

Codeforces Round #251 (Div. 2) C题: 题意:给定一些数字,要把这些数字方程k行,其中p行和为奇数,剩下和为偶数. 思路:根据奇数偶数的性质,先把p行放1个奇数,然后看看剩下的奇数是不是偶数个,如果不是肯定不满足,然后判断一下剩下的奇数个数/2加上偶数个数是否多余p个,如果不是肯定不满足,然后把这些放入p行,还有剩下的数字就全丢到最后一行去. D题: 题意:给定两个序列,每次操作可以对序列中的数字进行+1或者-1,要使得a序列的最小大于b序列的最大,问最少需要几次操

Codeforces Round #258 (Div. 2)Devu and Flowers 容斥原理

题目:Codeforces Round #258 (Div. 2)Devu and Flowers 题意:n个boxes ,第i个box有fi个flowers,每个boxes中的flowers完全相同,不同boxes的flowers不同,求从n个boxes中取出s个flowers的方案数.n<=20,s<=1e14,fi<=1e12. 排列组合的题目,一解法可用容斥原理(inclusion exclusion principle) . 有2中写法dfs和集合.下为集合写法. #inclu

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/

Codeforces Round #258 (Div. 2)

A - Game With Sticks 题目的意思: n个水平条,m个竖直条,组成网格,每次删除交点所在的行和列,两个人轮流删除,直到最后没有交点为止,最后不能再删除的人将输掉 解题思路: 每次删除交点所在的行和列,则剩下n-1行和m-1列,直到行或列被删完为止,最多删除的次数为min(n,m),删除min(n,m)后剩余的都是行或者列(注意行与行,列与列之间不可能有交点).只需要判断min(n,m)的奇偶性. #include <iostream> #include <vector&

Codeforces Round #258 (Div. 2)-(A,B,C,D,E)

http://blog.csdn.net/rowanhaoa/article/details/38116713 A:Game With Sticks 水题...每次操作,都会拿走一个横行,一个竖行. 所以一共会操作min(横行,竖行)次. #include<stdio.h> #include<iostream> #include<stdlib.h> #include<string.h> #include<algorithm> #include&l

Codeforces Round #428 (Div. 2)

Codeforces Round #428 (Div. 2) A    看懂题目意思就知道做了 #include<bits/stdc++.h> using namespace std; #pragma comment(linker, "/STACK:102400000,102400000") #define rep(i,a,b) for (int i=a; i<=b; ++i) #define per(i,b,a) for (int i=b; i>=a; --i