题意:根据题目,给定一些数字,让你判断是上升还是下降. 析:注意只有0,15时特别注意一下,然后就是14 15 1 0注意一下就可以了. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include <string> #include <cstdlib> #include <cmath> #include <iostr…
题目大意:月亮从0到15,15下面是0.循环往复.给出n个数字,如果下一个数字大于第n个数字输出UP,小于输出DOWN,无法确定输出-1. 题目思路:给出0则一定是UP,给出15一定是DOWN,给出其他的一个数字(n==1)无法确定,其他的情况比较后两位. #include<iostream> #include<algorithm> #include<cstring> #include<vector> #include<stdio.h> #inc…
A. Vitya in the Countryside 题目连接: http://codeforces.com/contest/719/problem/A Description Every summer Vitya comes to visit his grandmother in the countryside. This summer, he got a huge wart. Every grandma knows that one should treat warts when the…
题目链接:http://codeforces.com/problemset/problem/719/A 题目大意: 题目给出了一个序列趋势 0 .1 .2 .3 ---14 .15 .14 ----3 . 2 .1 .0.1--- 输入 整数 n ,第二行输入 n(1<=n<=92) 个数,判断下个数 是大于最后一个数还是小于最后一个,大于输出 UP,小于输出 DOWN,如果没法判断 输出 -1. 解题思路: 找转折点即可. 特判 n==1. 剩下的代码解释. AC Code: #includ…
链接:[http://codeforces.com/group/1EzrFFyOc0/contest/719/problem/A] 题意: 给你一个数列(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1),然后重复循环这个数列,输入一个n,再输入有n个元素的某段,问你接下来是UP还是DOWN,若无法判断输出-1. 思路: 枚举各种情况,注意n==1…
A. Vitya in the Countryside time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard output Every summer Vitya comes to visit his grandmother in the countryside. This summer, he got a huge wart. Every gran…
B. The Time 题目连接: http://www.codeforces.com/contest/622/problem/B Description You are given the current time in 24-hour format hh:mm. Find and print the time after a minutes. Note that you should find only the time after a minutes, see the examples t…
A. Infinite Sequence 题目连接: http://www.codeforces.com/contest/622/problem/A Description Consider the infinite sequence of integers: 1, 1, 2, 1, 2, 3, 1, 2, 3, 4, 1, 2, 3, 4, 5.... The sequence is built in the following way: at first the number 1 is wr…
A. Divisibility Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/597/problem/A Description Find the number of k-divisible numbers on the segment [a, b]. In other words you need to find the number of such integer values x tha…
A. Towers 题目连接: http://www.codeforces.com/contest/37/problem/A Description Little Vasya has received a young builder's kit. The kit consists of several wooden bars, the lengths of all of them are known. The bars can be put one on the top of the other…
题目链接: A. Vanya and Fence time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In orde…
题意:给定 n 条边,判断是不是树. 析:水题,判断是不是树,首先是有没有环,这个可以用并查集来判断,然后就是边数等于顶点数减1. 代码如下: #include <bits/stdc++.h> using namespace std; const int maxn =1000 + 5; int p[maxn]; int Find(int x){ return x == p[x] ? x : p[x] = Find(p[x]); } int main(){ int n, m, x, y; cin…
https://codeforc.es/contest/1194/problem/B 好像也没什么思维,就是一个水题,不过蛮有趣的.意思是找缺黑色最少的行列十字.用O(n)的空间预处理掉一维,然后用O(n)的时间根据另一维计算出答案. #include<bits/stdc++.h> using namespace std; typedef long long ll; int n, m; string g[50005]; int rq[50005]; int main() { #ifdef Yi…
Codeforces 1082B Vova and Trophies https://vjudge.net/problem/CodeForces-1082B 题目: Vova has won nn trophies in different competitions. Each trophy is either golden or silver. The trophies are arranged in a row. The beauty of the arrangement is the le…
题意:给定初始数量的冰激凌,然后n个操作,如果是“+”,那么数量就会增加,如果是“-”,如果现有的数量大于等于要减的数量,那么就减掉,如果小于, 那么孩子就会离家.问你最后剩下多少冰激凌,和出走的孩子数量. 析:多水的一个题,就是一个模拟,如果是+,就加上,如果是‘-’,就判断一下,如果不够,就记录下来. 代码如下: #include <iostream> #include <cmath> #include <cstdlib> #include <set>…
Problem A. Arrangement of Contest 题目连接: http://codeforces.com/gym/100269/attachments Description Little Dmitry and little Petr want to arrange a contest. Their little friends submitted several task proposals and now Dmitry and Petr want to select som…
Flag Day Descriptions 小G请你对 n 个点进行染色,可选的颜色有三种:白.红.蓝,并使得给定的 m 个三元组中,每个点的颜色各不相同. 因为你可能不会三分图匹配,于是小G给出了更多的特殊条件: 每个点在三元组中至少出现一次,至多出现两次. 第 i 个(i ≥ 2)三元组中,至多有一个点在第 1 个到第 i-1 个三元组中出现过. 虽然这题现在已经很水了,但是小G为了照顾萌新,你只要输出其中任意一种方案即可. Input 输入格式如下:n ma1 b1 c1a2 b2 c2……
题目链接: B. Memory and Trident time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Memory is performing a walk on the two-dimensional plane, starting at the origin. He is given a string s with hi…
题目链接: A. Memory and Crow time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output There are n integers b1, b2, ..., bn written in a row. For all i from 1 to n, values ai are defined by the crows pe…
题目链接: A. Bus to Udayland 题意: 找一对空位坐下来,水; 思路: AC代码: #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> #include <bits/stdc++.h> #include <stack> #include <map> usin…
H. Mysterious Photos Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100187/problem/H Description Everyone probably heard the rumours about the constellation of Bermuda Triangle: any person who looks to this constellation of th…
题目链接: D. Iterated Linear Function time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Consider a linear function f(x) = Ax + B. Let's define g(0)(x) = x and g(n)(x) = f(g(n - 1)(x)) for n > 0.…
题意:给定于所有的邮箱,都是由login@domain这样的形式构成,而且字符都是不区分大小写的. 我们有一种特殊类型的邮箱——@bmail.com, 这种邮箱除了不区分大小写外—— 1,'@'之前的'.',有等同于无 2,'@'之前的第一个'+'之后的字符可以忽略不计 然后其他字符相同的被认定为邮箱相同. 现在给你 n 个邮箱,让你输出每个邮箱出现的次数与所有这个邮箱的原始串. 析:没什么好说的,就是先判断不是@bmail.com,然后再按要求去点,去+和@之间的值,然后一个一个的比较即可,这…
Problem H. ICPC QuestTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100500/attachments Description Coach Fegla has invented a song effectiveness measurement methodology. This methodology in simple English means count the frequ…
A题和B题...   A. Saitama Destroys Hotel time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Saitama accidentally destroyed a hotel again. To repay the hotel company, Genos has volunteered to opera…
题目链接:https://codeforces.com/contest/1090/problem/M There are n houses along the road where Anya lives, each one is painted in one of k possible colors. Anya likes walking along this road, but she doesn't like when two adjacent houses at the road have…
F. Ilya Muromets Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100513/problem/F Description I Ilya Muromets is a legendary bogatyr. Right now he is struggling against Zmej Gorynych, a dragon with n heads numbered from 1 to nf…
A. Co-prime Array 题目连接: http://www.codeforces.com/contest/660/problem/A Description You are given an array of n elements, you must make it a co-prime array in as few moves as possible. In each move you can insert any positive integral number you want…
C. Foe Pairs 题目连接: http://www.codeforces.com/contest/652/problem/C Description You are given a permutation p of length n. Also you are given m foe pairs (ai, bi) (1 ≤ ai, bi ≤ n, ai ≠ bi). Your task is to count the number of different intervals (x, y…
D. Weird Chess Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/538/problem/D Description Igor has been into chess for a long time and now he is sick of the game by the ordinary rules. He is going to think of new rules of th…