codeforces#281 A】的更多相关文章

shui #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; ; int numa[maxn],numb[maxn]; long long suma,sumb; int main() { int n; while(scanf("%d",&n)!=EOF) { int etc; ,lb=,last…
脑子有点秀逗 #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> using namespace std; ]={}; ]={}; int main() { string away,home; cin>>home>>away; int n; cin>>n; ;i<n;i++) {…
题目链接:http://codeforces.com/contest/493 A. Vasya and Football Vasya has started watching football games. He has learned that for some fouls the players receive yellow cards, and for some fouls they receive red cards. A player who receives the second y…
题目地址:http://codeforces.com/contest/493 A题 写完后就交了,然后WA了,又读了一遍题,没找出错误后就开始搞B题了,后来回头重做的时候才发现,球员被红牌罚下场后还可以再出现,但不能再参与计算,这里需要开一个flag数组判重 .打比赛时要调整好心态. #include<cstdio> #include<iostream> #include<string.h> #include<stdlib.h> #include<st…
题目:http://codeforces.com/problemset/problem/493/D 题意:一个n*n的地图,有两个人在比赛,第一个人是白皇后开始在(1,1)位置,第二个人是黑皇后开始在(1,n)位置,然后问你谁嬴,并且如果是白赢输出第一步走的什么 如果有多个答案输出x最小,还有相同输出y最小 思路:在n为奇数的时候,我们白无论走什么,我们黑都可以对称走,最后就会到最中间一行,然后黑色获胜 n为偶数的时候我们白可以先走到(1,2)就可以转换为n为奇数的情况,然后白获胜 #inclu…
B. Vasya and Wrestling 题目连接: http://codeforces.com/contest/493/problem/B Description Vasya has become interested in wrestling. In wrestling wrestlers use techniques for which they are awarded points by judges. The wrestler who gets the most points wi…
A. Vasya and Football 题目连接: http://codeforces.com/contest/493/problem/A Description Vasya has started watching football games. He has learned that for some fouls the players receive yellow cards, and for some fouls they receive red cards. A player wh…
D. Vasya and Chess time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Vasya decided to learn to play chess. Classic chess doesn't seem interesting to him, so he plays his own sort of chess. T…
C. Vasya and Basketball time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Vasya follows a basketball game and marks the distances from which each team makes a throw. He knows that each succe…
D. Vasya and Chess time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Vasya decided to learn to play chess. Classic chess doesn't seem interesting to him, so he plays his own sort of chess. T…
C. Vasya and Basketball time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Vasya follows a basketball game and marks the distances from which each team makes a throw. He knows that each succe…
A. Vasya and Football time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Vasya has started watching football games. He has learned that for some fouls the players receive yellow cards, and fo…
简单题,却犯了两个错误导致WA了多次. 第一是程序容错性不好,没有考虑到输入数据中可能给实际已经罚下场的人再来牌,这种情况在system测试数据里是有的... 二是chronologically这个词没注意,其实如果输入是按时间顺序的,就直接在线处理就行了,用不着int team1[110][110],team2[110][110]两个数组. #include<iostream> #include<cstdio> #include<cstdlib> #include&l…
B. Vasya and Wrestling time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Vasya has become interested in wrestling. In wrestling wrestlers use techniques for which they are awarded points by…
A. Vasya and Football time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Vasya has started watching football games. He has learned that for some fouls the players receive yellow cards, and fo…
D. Vasya and Chess   Vasya decided to learn to play chess. Classic chess doesn't seem interesting to him, so he plays his own sort of chess. The queen is the piece that captures all squares on its vertical, horizontal and diagonal lines. If the cell…
C. Vasya and Basketball   Vasya follows a basketball game and marks the distances from which each team makes a throw. He knows that each successful throw has value of either 2 or 3 points. A throw is worth 2 points if the distance it was made from do…
A. Vasya and Football   Vasya has started watching football games. He has learned that for some fouls the players receive yellow cards, and for some fouls they receive red cards. A player who receives the second yellow card automatically receives a r…
C. Rectangle Puzzle Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/281/problem/C Description You are given two rectangles on a plane. The centers of both rectangles are located in the origin of coordinates (meaning the cen…
B. Nearest Fraction Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/281/problem/B Description You are given three positive integers x, y, n. Your task is to find the nearest fraction to fraction  whose denominator is no mor…
目录 Codeforces 1114 A.Got Any Grapes? B.Yet Another Array Partitioning Task C.Trailing Loves (or L'oeufs?) D.Flood Fill(区间DP) E.Arithmetic Progression(交互 二分 随机化) F.Please, another Queries on Array?(线段树 欧拉函数) Codeforces 1114 比赛链接 貌似最近平均难度最低的一场div2了...…
题目链接:http://www.codeforces.com/problemset/problem/281/A题意:将一个英文字母的首字母变成大写,然后输出.C++代码: #include <cstdio> #include <cstring> ]; void solve(char *s) { if (*s >= 'a' && *s <= 'z') *s -= ; while (*s) { putchar(*s); s ++; } } int main(…
http://codeforces.com/contest/281/problem/D 要求找出一个区间,使得区间内第一大的数和第二大的数异或值最大. 首先维护一个单调递减的栈,对于每个新元素a[i].要么直接插入后面,如果它插入栈内的某个元素的话.就是说有数字弹出来了,这个时候这个数字和a[i]组成的就是区间第一.第二大,9 8 5 4 3 2 1 7这样,最后那个7,弹出1,证明[7,8]这个区间第一.第二大的数字分别是1.和7,其他类似. 还有一个地方要注意的是: 要特别处理那些不能弹出的…
上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题.. 今天,我们来扒一下cf的题面! PS:本代码不是我原创 1. 必要的分析 1.1 页面的获取 一般情况CF的每一个 contest 是这样的: 对应的URL是:http://codeforces.com/contest/xxx 还有一个Complete problemset页面,它是这样的:…
http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n grid. In this game a ships are placed on the grid. Each of the ships consists of bconsecutive cells. No cell can be part of two ships, however, the shi…
http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants to reach cinema. The film he has bought a ticket for starts in t minutes. There is a straight road of length s from the service to the cinema. Let's…
http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interview down without punctuation marks and spaces to save time. Thus, the interview is now a string s consisting of n lowercase English letters. There is…
http://codeforces.com/problemset/problem/662/A 题目大意: 给定n(n <= 500000)张卡片,每张卡片的两个面都写有数字,每个面都有0.5的概率是在正面,各个卡牌独立.求把所有卡牌来玩Nim游戏,先手必胜的概率. (⊙o⊙)-由于本人只会在word文档里写公式,所以本博客是图片格式的. Code #include <cstdio> #include <cstring> #include <algorithm> u…
http://codeforces.com/problemset/problem/274/B 题目大意: 给定你一颗树,每个点上有权值. 现在你每次取出这颗树的一颗子树(即点集和边集均是原图的子集的连通图)且这颗树中必须包含节点1 然后将这颗子树中的所有点的点权+1或-1 求把所有点权全部变为0的最小次数(n<=10^5) 题解: 因为每一次的子树中都必须有1,所以我们得知每一次变换的话1的权值都会变化 所以我们以1为根 现在,我们发现,如果一个节点的权值发生变化,那么他的父节点的权值一定发生变…
http://codeforces.com/problemset/problem/261/B 题目大意:给定n个数a1-an(n<=50,ai<=50),随机打乱后,记Si=a1+a2+a3-+ai,问满足Si<=p的i的最大值的期望.(p<=50) (大意来自于http://www.cnblogs.com/liu-runda/p/6253569.html) 我们知道,全排列其实等价于我们一个一个地等概率地向一个序列里面插入数值 所以我们可以这么看这道题: 现在有n个数,有n个盒子…